Part Number Hot Search : 
ML412PJB AD5274 741G07 ON0909 BFR93 EVICE TFS368A DC100
Product Description
Full Text Search
 

To Download PG164120 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ? 2008 microchip technology inc. ds51553e pickit? 2 programmer/debugger user?s guide
ds51553e-page ii ? 2008 microchip technology inc. information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. it is your responsibility to ensure that your application meets with your specifications. microchip makes no representations or warranties of any kind whether express or implied, written or oral, statutory or otherwise, related to the information, including but not limited to its condition, quality, performance, merchantability or fitness for purpose . microchip disclaims all liability arising from this information and its use. use of microchip devices in life support and/or safety applications is entirely at the buyer?s risk, and the buyer agrees to defend, indemnify and hold harmless microchip from any and all damages, claims, suits, or expenses resulting from such use. no licenses are conveyed, implicitly or otherwise, under any microchip intellectual property rights. trademarks the microchip name and logo, the microchip logo, accuron, dspic, k ee l oq , k ee l oq logo, mplab, pic, picmicro, picstart, pro mate, rfpic and smartshunt are registered trademarks of microchip tec hnology incorporated in the u.s.a. and other countries. filterlab, linear active thermistor, mxdev, mxlab, seeval, smartsensor and the embedded control solutions company are registered trademarks of microchip technology incorporated in the u.s.a. analog-for-the-digital age, appl ication maestro, codeguard, dspicdem, dspicdem.net, dspicworks, dsspeak, ecan, economonitor, fansense, in-circuit serial programming, icsp, icepic, mindi, miwi, mpasm, mplab certified logo, mplib, mplink, mtouch, pickit, picdem, picdem.net, pictail, pic 32 logo, powercal, powerinfo, powermate, powertool, real ice, rflab, select mode, total endurance, uni/o, wiperlock and zena are trademarks of microchip technology incorporated in the u.s.a. and other countries. sqtp is a service mark of microchip technology incorporated in the u.s.a. all other trademarks mentioned herein are property of their respective companies. ? 2008, microchip technology incorporated, printed in the u.s.a., all rights reserved. printed on recycled paper. note the following details of the code protection feature on microchip devices: ? microchip products meet the specification cont ained in their particular microchip data sheet. ? microchip believes that its family of products is one of the mo st secure families of its kind on the market today, when used i n the intended manner and under normal conditions. ? there are dishonest and possibly illegal methods used to breach the code protection feature. all of these methods, to our knowledge, require using the microchip produc ts in a manner outside the operating specifications contained in microchip?s data sheets. most likely, the person doing so is engaged in theft of intellectual property. ? microchip is willing to work with the customer who is concerned about the integrity of their code. ? neither microchip nor any other semiconductor manufacturer c an guarantee the security of their code. code protection does not mean that we are guaranteeing the product as ?unbreakable.? code protection is constantly evolving. we at microchip are co mmitted to continuously improvi ng the code protection features of our products. attempts to break microchip?s c ode protection feature may be a violation of the digital millennium copyright act. if such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that act. microchip received iso/ts-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in chandler and tempe, arizona; gresham, oregon and design centers in california and india. the company?s quality system processes and procedures are for its pic ? mcus and dspic ? dscs, k ee l oq ? code hopping devices, serial eeproms, microperipherals, nonvolatile memory and analog products. in addition, microchip?s quality system for the design and manufacture of development systems is iso 9001:2000 certified.
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page iii table of contents preface ....................................................................................................................... .... 1 chapter 1. pickit 2 programmer/debugger overview 1.1 introduction ..................................................................................................... 7 1.2 pickit 2 development programmer/debugger contents ............................... 7 1.3 pickit 2 development programmer/debugger ............................................... 7 1.4 pickit 2 programmer application ................................................................. 10 chapter 2. pickit 2 programmer getting started 2.1 introduction ................................................................................................... 15 2.2 installing the pickit 2 hardware ................................................................... 15 2.3 installing and launching the pickit 2 programmer application ................... 16 2.4 connecting to the device ............................................................................. 16 2.5 selecting target power ................................................................................ 18 2.6 importing a hex file ..................................................................................... 19 2.7 writing the program to the device ............................................................... 20 2.8 verifying the device ..................................................................................... 23 2.9 reading device memory .............................................................................. 23 2.10 code protecting the device ........................................................................ 23 2.11 erasing and blank checking the device .................................................... 24 2.12 automating write/read procedures ........................................................... 24 2.13 pickit 2 calibration and unit id .................................................................. 25 chapter 3. using in-circuit serial programming? (icsp?) 3.1 introduction ................................................................................................... 27 3.2 isolate v pp /mclr /port pin ........................................................................... 28 3.3 isolate icspclk or pgc and icspdat or pgd pins ................................. 28 3.4 v dd ............................................................................................................... 29 3.5 v ss ............................................................................................................... 30 3.6 cable lengths .............................................................................................. 30 3.7 serial eeprom and keeloq hcs devices ................................................. 30 chapter 4. pickit 2 debug express 4.1 introduction ................................................................................................... 31 4.2 pickit 2 debug express kit contents ........................................................... 31 4.3 installing the hardware and software .......................................................... 32 4.4 using pickit 2 debug express ..................................................................... 32 4.5 debug express tutorial ................................................................................ 36
pickit? 2 user?s guide ds51553e-page iv ? 2008 microchip technology inc. chapter 5. troubleshooting 5.1 introduction ................................................................................................... 49 5.2 frequently asked questions ........................................................................ 49 5.3 pickit 2 debug express mplab ide errors ................................................ 54 chapter 6. updating the pickit 2 operating system 6.1 introduction ................................................................................................... 61 6.2 updating the pickit 2 os - pickit 2 programmer application ...................... 61 6.3 updating the pickit 2 os ? mplab ide ...................................................... 62 chapter 7. pickit 2 uart tool 7.1 introduction ................................................................................................... 65 7.2 connecting the pickit 2 uart tool ............................................................. 65 7.3 the pickit 2 uart tool window ................................................................. 66 appendix a. mpl ab ide reference a.1 introduction .................................................................................................. 71 a.2 debugging functions ................................................................................... 71 a.3 programming functions ............................................................................... 73 a.4 settings dialog ............................................................................................. 75 appendix b. pickit 2 schematics index ......................................................................................................................... ....79 worldwide sales and service .....................................................................................82
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page 1 preface introduction this chapter contains general information that will be useful to know before using pickit? 2 . items discussed include: ? document layout ? c onventions used in this guide ? warranty registration ? recommended reading ? t he microchip web site ? development systems customer change notification service ? customer support notice to customers all documentation becomes dated, and this manual is no exception. microchip tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ from those in this document. please refer to our web site (www.microchip.com) to obtain the latest documentation available. documents are identified with a ?ds? number. this number is located on the bottom of each page, in front of the page number. the numbering convention for the ds number is ?dsxxxxxa?, where ?xxxxx? is the document number and ?a? is the revision level of the document. for the most up-to-date information on development tools, see the mplab ? ide on-line help. select the help menu, and then topics to open a list of available on-line help files.
pickit? 2 user?s guide ds51553e-page 2 ? 2008 microchip technology inc. document layout this document describes how to use the pickit 2 as a development tool to emulate and debug firmware on a target board. the manual layout is as follows: ? chapter 1. pickit 2 programmer/debugger overview ? provides an overview of the pickit 2 programmer/debugger. ? chapter 2. pickit 2 programmer getting started ? provides instructions on how to get started using the pickit 2 programmer/debugger to program flash-based pic ? microcontroller units (mcus). ? chapter 3. using in-circuit serial programming? (icsp?) ? describes pro- gramming with the pickit 2 programmer/debugger using in-circuit serial programming ? (icsp ? ). ? chapter 4. pickit 2 debug express ? provides a tutorial on using the pickit? 2 debug express debugger program. ? chapter 5. troubleshooting ? provides information on solving common problems and debug express errors. ? chapter 6. updating the pickit 2 operating system ? provides instruction on how to update your pickit 2 programmer/debugger?s operating system. ? chapter 7. pickit 2 uart tool ? provides information on using the pickit 2 as a serial uart terminal interface for communicating with a pic microcontroller ? appendix a. mplab ide reference ? describes how the pickit 2 programmer/debugger works with mplab ide. ? appendix b. pickit 2 schematics ? illustrates the pickit 2 programmer/debugger hardware schematic diagrams.
preface ? 2008 microchip technology inc. ds51553e-page 3 conventions used in this guide the following conventions may appear in this documentation: documentation conventions description represents examples arial font: italic referenced books mplab ? ide user?s guide emphasized text ...is the only compiler... initial caps a window the output window a dialog the settings dialog a menu selection select enable programmer quotes a field name in a window or dialog ?save project before build? underlined, italic with right angle bracket a menu path file>save bold characters a dialog button click ok a tab click the power tab text in angle brackets < > a key on the keyboard press , courier new font: plain sample source code #define start filenames autoexec.bat file paths c:\mcc18\h keywords _asm, _endasm, static command-line options -opa+, -opa- bit values 0, 1 constants 0xff,?a? italic a variable argument file .o , where file can be any valid filename square brackets [ ] optional arguments mpasmwin [options] file [options] curly brackets and pipe character: { | } choice of mutually exclusive arguments; an or selection errorlevel {0|1} ellipses... replaces repeated text var_name [, var_name...] represents code supplied by user void main (void) { ... }
pickit? 2 user?s guide ds51553e-page 4 ? 2008 microchip technology inc. warranty registration please complete the enclosed warranty registration card and mail it promptly. sending in the warranty registration card entitles users to receive new product updates. interim software releases are available at the microchip web site. recommended reading this user's guide describes how to use pickit 2 . other useful documents are listed below. the following microchip documents are available and recommended as supplemental reference resources. 44-pin demo board user?s guide (ds41296) consult this document for instructions on how to use the 44-pin demo board as a development tool to emulate and debug firmware on a target board. low pin count demo board user?s guide (ds51556) consult this document for instructions on how to use microchip technology?s low pin count device (8-pin, 14-pin and 20-pin). this document includes a series of tutorials. mplab ? ide quick start guide (ds51281) describes how to set up the mplab ide software and use it to create projects and program devices. mplab ? ide user?s guide/help (ds51519) consult this document for more information pertaining to the installation and features of the mplab integrated development environment (ide) software. an on-line help version is also available. in-circuit serial programmer? (icsp?) guide (ds30277) this document contains helpful design guidelines for successful icsp programming. it includes application notes on hardware designs and the icsp programming specifications. mpasm? assembler, mplink? object linker, mplib? object librarian user?s guide (ds33014) describes how to use the microchip pic ? mcu assembler (mpasm assembler), linker (mplink linker), and librarian (mplib librarian). readme for pickit? 2 debug express for the latest information on using the pickit 2 debug express, read the ? readme for pickit 2.htm ? file (an html file) in the readmes subdirectory of the mplab ide installation directory. the readme file contains updated information and known issues that may not be included in this user?s guide. readme files for the latest information on using other tools, read the tool-specific readme files in the readmes subdirectory of the mplab ide installation directory. the readme files contain updated information and known issues that may not be included in this user?s guide.
preface ? 2008 microchip technology inc. ds51553e-page 5 the microchip web site microchip provides online support via our web site at www.microchip.com . this web site is used as a means to make files and information easily available to customers. accessible by using your favorite internet browser, the web site contains the following information: ? product support ? data sheets and errata, application notes and sample programs, design resources, user?s guides and hardware support documents, latest software releases and archived software ? general technical support ? frequently asked questions (faqs), technical support requests, online discussion groups, microchip consultant program member listing ? business of microchip ? product selector and ordering guides, latest microchip press releases, listing of seminars and events, listings of microchip sales offices, distributors and factory representatives development systems custome r change notification service microchip?s customer notification service helps keep customers current on microchip products. subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest. to register, access the microchip web site at www.microchip.com , click on customer change notification and follow the registration instructions. the development systems product group categories are: ? compilers ? the latest information on microchip c compilers and other language tools. these include the mplab c18 and mplab c30 c compilers; mpasm? and mplab asm30 assemblers; mplink? and mplab link30 object linkers; and mplib? and mplab lib30 object librarians. ? emulators ? the latest information on microchip in-circuit emulators.this includes the mplab real ice? and mplab ice 2000 in-circuit emulators. ? in-circuit debuggers ? the latest information on the microchip in-circuit debuggers. this includes the mplab icd 2 and pickit? 2. ? mplab ? ide ? the latest information on microchip mplab ide, the windows ? integrated development environment for development systems tools. this list is focused on the mplab ide, mplab ide project manager, mplab editor and mplab sim simulator, as well as general editing and debugging features. ? programmers ? the latest information on microchip programmers. these include the mplab pm3 device programmer and the picstart ? plus, pickit 1 and pickit 2 development programmers.
pickit? 2 user?s guide ds51553e-page 6 ? 2008 microchip technology inc. customer support users of microchip products can receive assistance through several channels: ? distributor or representative ? local sales office ? field application engineer (fae) ? technical support customers should contact their distributor, representative or field application engineer (fae) for support. local sales offices are also available to help customers. a listing of sales offices and locations is included in the back of this document. see our web site for a complete, up-to-date listing of sales offices. technical support is available through the web site at: http://support.microchip.com .
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page 7 chapter 1. pickit 2 pr ogrammer/debugger overview 1.1 introduction this chapter introduces the pickit 2 development programmer/debugger features and pickit 2 programmer application menu functions. this chapter discusses: ? pickit 2 development programmer/debugger contents ? p ic kit 2 develo pment programmer/debugger ? pic kit 2 p rogrammer application 1.2 pickit 2 development programmer/debugger contents the pickit 2 development programmer/debugger kit contains the following items: 1. the pickit 2 development programmer/debugger 2. usb cable 3. pickit starter kit and mplab ide cd-roms additionally, the pickit 2 starter kit and pickit 2 debug express kit both contain a demo board with a pic microcontroller device. 1.3 pickit 2 development programmer/debugger the pickit 2 development programmer/debugger is a low-cost development program- mer. it is capable of programming most of microchip?s flash microcontrollers and serial eeprom devices. for specific device support, see the readme file included on the pickit 2 starter kit cd-rom. new device support can be added by updating the programming software. the latest software is available on microchip?s web site page for the pickit 2: w ww.microchip.com/pickit2 . the pickit 2 also may be used to debug selected devices. see chapter 4. ?pickit 2 debug express? for more details. note: the pickit 2 is intended for development programming. for production programming, please consider the mplab pm3 device programmer or other third party programmers designed for a production environment.
pickit? 2 user?s guide ds51553e-page 8 ? 2008 microchip technology inc. the pickit 2 unit is shown in figure 1-1. figure 1-1: pickit? 2 mcu programmer/debugger 1.3.1 usb port connection the usb port connection is a usb mini-b connec tor. connect the pickit 2 to the pc using the supplied usb cable. 1.3.2 status leds the status leds indicate the status of the pickit 2. 1. power (green) ? power is applied to the pickit 2 via the usb port. 2. target (yellow) ? the pickit 2 is powering the target device. 3. busy (red) ? the pickit 2 is busy with a function in progress, such as programming. 1.3.3 push button the push button may be used to initiate the write device programming function when programmer>write on pickit button is checked on the pickit 2 programmer application menu (see item labeled 2 in figure 1-1.) the push button may also be used to put the pickit 2 unit operating system firmware into bootloader mode. for more information on this feature, see chapter 6. ?updating the pickit 2 operating system? . 1.3.4 programming connector the programming connector is a 6-pin header (0.100" spacing) that connects to the target device. see the pinout specification in figure 1-2. for more information on how to use the pickit 2 with in-circuit serial programming (icsp), refer to chapter 3. ?using in-circuit serial programming? (icsp?)? . 1 2 4 3 5 6 legend: 1 ? status leds 3 ? lanyard connection 5 ? pin 1 marker 2 ? push button 4 ? usb port connection 6 ? programming connector
pickit 2 programmer/debugger overview ? 2008 microchip technology inc. ds51553e-page 9 figure 1-2: pickit? 2 pr ogrammer connector pinout 1.3.5 lanyard connection to help prevent possible loss of the pickit 2, a convenient lanyard connection is available on the programmer. 1 2 3 4 5 6 * the 6-pin header (0.100" spacing) accepts 0.025" square pins. pin description* 1 = v pp /mclr 2 = v dd target 3 = v ss (ground) 4 = icspdat/pgd 5 = icspclk/pgc 6 = auxiliary pin 1 indicator note: the programming connector pin functions are different for programming serial eeproms and hcs devices. see the readme file ( help>readme) included with the pickit 2 programming software for these pinouts.
pickit? 2 user?s guide ds51553e-page 10 ? 2008 microchip technology inc. 1.4 pickit 2 programmer application the pickit 2 programmer application allows you to program all supported devices listed in the pickit 2 readme file. the programming interface appears as shown in figure 1-3. its controls are listed in the following sections. for more information on how to install and use the pickit 2 programmer application, see chapter 2. ?pickit 2 programmer getting started? . figure 1-3: pickit? 2 programmer application menu bar status window progress bar program memory device configuration eeprom data memory memory source device v dd
pickit 2 programmer/debugger overview ? 2008 microchip technology inc. ds51553e-page 11 1.4.1 menu bar the menu bar selects various functions of the pickit 2 programmer application. a summary of the functions are: file ?import hex ? import a hex file for programming. the hex file format inhx32 is supported. ? export hex ? export a hex file read from a device.the hex file is created in the inhx32 format. ? file history ? up to the last four hex files opened are displayed with their filepath. these recent hex files may be selected to quickly import them. note that the file history will initially be blank on a new installation until a hex file is imported. ?exit ? exit the program. device family select a device family to search for a connected device in that family. selecting the device family of the current part will clear all device data. some families which cannot be auto-detected (such as baseline) will bring up a drop down box from which supported devices may be selected. programmer ? read device ? reads program memory, data eeprom memory, id locations and configuration bits. ? write device ? writes program memory, data eeprom memory, id locations and configuration bits. ?verify ? verifies program memory, data eeprom memory, id locations and configuration bits read from the target mcu against the code stored in the programming application. ?erase ? performs a bulk erase of the target mcu. osccal and band gap values are preserved on parts with these features. ? blank check ? performs a blank check of program memory, data eeprom memory, id locations and configuration bits. ? verify on write ? when checked, the device will be immediately verified after programming on a write (recommended). when unchecked, the device will be programmed but not verified on a write. ? hold device in reset ? when checked, the mclr (v pp ) pin is held low (asserted). when unchecked, the pin is released (tri-stated), allowing an external pull-up to bring the device out of reset. ? write on pickit button ? when checked, a write operation will be initiated by pressing the pickit 2 push button. tools ? enable code protect ? enables code protection features of the microcontroller on future write operations. ?e nable data protect ? enables data protection feature of microcontrollers with data eeprom memory on future write operations. note: to disable code protect, all device memory must be erased and rewritten. note: to disable data protect, all device memory must be erased and rewritten.
pickit? 2 user?s guide ds51553e-page 12 ? 2008 microchip technology inc. ?s et osccal ? allows the osccal value to be changed for devices where it is stored in the last location of program memory. ? targe t v dd source -auto-detect ? the pickit 2 will automatically detect whether the target device has its own power supply or needs to be powered by the programmer on each operation. -force pickit 2 ? the pickit 2 will always attempt to supply v dd to the target device. - force target ? the pickit 2 will always assume the target has its own power supply. ?calibrate v dd & set unit id ? opens a wizard that steps the user through calibrat- ing the pickit 2 v dd supplied voltage so it is more accurate, and optionally assigning a unit id to identify between multiple pickit 2 devices. ?use v pp first program entry ? when checked, it allows the pickit 2 to connect to and program devices with configurations and code that interferes with the icsp signal pins, preventing pickit 2 from detecting them. using this feature requires that the pickit 2 supplies v dd to the target. ?fast programming ? when checked, the pickit 2 will attempt to program the device as fast as possible. when unchecked, the pickit 2 will slow down icsp communication. this may be helpful for targets with loaded icsp lines. ? check communication ? verifies usb communication with the pickit 2 and icsp communication with a target device by attempting to identify the connected device by its device id. ? uart tool? - puts the pickit 2 in uart mode and opens a terminal-like interface for communicating with a pic mcu device program through the usart pins. see chapter 7. ?pickit 2 uart tool? for more information. ? troubleshoot ... ? opens a wizard to help with troubleshooting connectivity from the pickit 2 to the target device. this is most useful where the programmer is unable to detect the target device at all. ? download pickit 2 p rogrammer operating system ? performs a download of the pickit 2 operating system (firmware). help ?pickit2 u ser?s guide ? attempts to launch the user?s guide pdf (adobe ? reader must be installed). ? 44-pin demo board guide ? attempts to launch the 44-pin demo board user?s guide pdf (adobe reader must be installed). ? lpc demo board guide ? attempts to launch the low pin count demo board user?s guide pdf (adobe reader must be installed). ? pickit 2 p rogrammer on the web ? opens www.microchip.com/pickit2 in the default web browser. ? readme ? opens the pickit 2 readme.txt file. ? about ? opens a dialog with the pickit 2 programmer application version, device file version and firmware version. 1.4.2 device configuration the device configuration window displays the device, user id, configuration word and checksum. it also displays osccal and band gap for parts with those features. for baseline (12-bit core) devices, serial eeprom devices, and keeloq ? hcs devices, you must select the device from the device drop-down menu.
pickit 2 programmer/debugger overview ? 2008 microchip technology inc. ds51553e-page 13 all other part family devices will be detected by their device id and the part name will be displayed on the device line. 1.4.3 status window the status window displays text status of the operations in progress. if an operation is successful, the status window will display a green background. if an operation fails, the status window will display red. if an operation alerts a caution, the status window will display yellow. 1.4.4 progress bar the progress bar displays the progress of an operation. 1.4.5 device v dd the pickit 2 v dd may be turned on and off by clicking the checkbox ?on?. the voltage may be set in the box on the right either by typing it directly or using the up/down arrows to adjust it a tenth of a volt at a time. the maximum and minimum allowed voltages will vary depending on the target device. if the ?on? checkbox is unchecked, pickit 2 will automatically turn on the v dd at the set voltage during any requested programming operation. figure 1-4: pickit? 2 supplied v dd if the target device has its own power supply, then the pickit 2 will display the detected v dd voltage in the box on the right, which will be grayed out to prevent being changed. the checkbox text changes to ?check?, and clicking on the checkbox will update the detected v dd voltage value. if targe t v dd >auto-detect is selected, clicking on the checkbox will revert the v dd mode back to pickit 2 supplied v dd if a target power supply is no longer detected. figure 1-5: target supplied v dd 1.4.6 device mclr state the ?/mclr? checkbox shown in figure 1-4 and figure 1-5 has the same functionality as the menu selection programmer >h old device in reset . when the box is checked the target device will be held in reset. when unchecked, the target circuit is allowed to pull mclr up to v dd to release the device from reset. this function can be used to prevent a device from executing code before and after programming. note: if the target device allows the mclr pin to be configured as an input port, and it is configured as such, pickit 2 will not be able to hold the device in reset.
pickit? 2 user?s guide ds51553e-page 14 ? 2008 microchip technology inc. 1.4.7 memory source the source bar displays the source of the currently loaded device data. if read from a hex file, it will display the hex file name. if read from a device, it will display the part name. none (empty/erased) indicates the buffers are empty, and it will display edited once program memory or data eeprom memory has been edited in the window. 1.4.8 program memory program code can be loaded into the pickit 2 programmer application by selecting file>import hex to import a hex file or by clicking read to read the device memory. the origin of the code is displayed in the source block. the program memory window displays the program code in hexadecimal. the code may be edited in the window. the checkbox next to the program memory window is only available on devices with eeprom data memory. if the box is checked, then program memory, user ids, and configuration words are written to, read from, and verified on the device. if the box is unchecked, then program memory, user ids, and configuration words will not be erased or altered during a write device operation, and will not be read or verified. the checkbox does not affect erase device or blank check operations. both memory window checkboxes may not be cleared at the same time. for supported serial eeprom devices, the device contents are displayed in the pro- gram memory window instead of the data eeprom memory window for easier viewing in the larger display area. 1.4.9 data eeprom memory similar to program memory above, data eeprom code can be loaded into the pickit 2 programmer application by selecting file>import hex to import a hex file or by clicking read to read the device memory. the origin of the code is displayed in the source block. the data eeprom memory window displays the program code in hexadecimal. the code may be edited in the window. the check box next to the eeprom data window controls whether the eeprom data memory is written, read and verified. if the box is checked, then the device eeprom will be overwritten with the window data. if the box is not checked, then the device eeprom will not be erased or altered during a write device operation. the checkbox does not affect erase device or blank check operations. both memory window checkboxes may not be cleared at the same time.
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page 15 chapter 2. pickit 2 pr ogrammer getting started 2.1 introduction this chapter gives instruction on how to get started using the pickit 2 development programmer/debugger to program flash-based pic microcontroller units. for information on how to use the pickit 2 with in-circuit serial programming? (icsp?), refer to chapter 3. ?using in-circuit serial programming? (icsp?)? . for information on how to update the pickit 2 operating system (firmware), refer to chapter 6. ?updating the pickit 2 operating system? . for information on using the pickit 2 as a debugger in mplab ide, see chapter 4. ?pickit 2 debug express? . ? installing the pic kit 2 ha rdware ? installing and launching the pic kit 2 programmer application ? connecting to the device ? selecting target power ? importing a hex file ? writing the program to the device ? verifying the device ? reading device memory ? code p rotecting the device ? erasing and blank checking the device ? automating write/read procedures 2.2 installing the pickit 2 hardware to install the pickit 2 hardware: ? plug one end of the usb cable into pickit 2 usb connector. plug the other end into a usb port on your pc. ? connect the pickit 2 to a target board via a 6-pin connector. the target board can be the included demo board or any target equipped with the appropriate 6-pin connector. ? do not connect the pickit 2 to a target board that has its own power supply if it is not connected to a powered usb port. ? to connect the pickit 2 to a target with an mplab icd 2 style rj-11 connector, the ac164110 rj-11 to icsp adapter kit is required. when plugging the pickit 2 into the usb, it is recommended to disconnect it from any target board first. similarly, when starting up or rebooting the host pc, ensure it is disconnected from a target. for more information about the pickit 2 hardware, see section 1.3 ?pickit 2 development programmer/debugger? .
pickit? 2 user?s guide ds51553e-page 16 ? 2008 microchip technology inc. 2.3 installing and launching the pickit 2 programmer application insert the pickit 2 starter kit cd-rom into the cd-rom drive. in a few moments, the introductory screen should be displayed. follow the directions on the screen for installing the pickit 2 programmer application. if the introductory screen does not appear, browse to the cd-rom directory and open the pickit_starter_kit_welcome.htm file. once installed, start the pickit 2 programmer application by selecting start>programs>microchip>pickit 2 . the programming interface appears as shown in figure 2-1. a listing of its features and functions may be found in section 1.4 ?pickit 2 programmer application? . figure 2-1: pickit? 2 pr ogramming application 2.4 connecting to the device the pickit 2 is capable of programming a variety of flash-based microchip pic micro- controllers and serial eeprom devices. supported devices are listed in the pickit 2 readme file on the cd-rom, which can also be viewed by selecting help>readme . when the pickit 2 programmer application is first opened, it will attempt to identify the connected device by the device id and displa y it in the configuration window as shown in figure 2-2.
pickit 2 programmer getting started ? 2008 microchip technology inc. ds51553e-page 17 figure 2-2: identify device if the device on the target is not correctly identified, check the target power ( section 2.5 ?selecting target power? ) and device icsp connections before attempting to reselect or change the device. at any time, the device family may be selected to search for connectivity to a device in that family. to connect to a device once the application is already running, select the device family by clicking on the device family menu as shown in figure 2-3. figure 2-3: select device family if the baseline (12-bit core), k ee l oq ? hcs or eeproms device family is selected, you must select the specific device from the device drop-down box as shown in figure 2-4. these devices do not have a device id and do not support automatic detection. caution ensure that the correct baseline has been selected. these devices do not contain a device id to confirm device selection. choosing the wrong baseline may cause an erasing of the osccal value stored in the last memory location.
pickit? 2 user?s guide ds51553e-page 18 ? 2008 microchip technology inc. figure 2-4: select baseline flash device 2.5 selecting target power the pickit 2 can supply power to the target or the target may be powered externally. 2.5.1 target powered from pickit 2 if you are going to power the target board from the pickit 2, do not attach a power sup- ply to the target or the pickit 2 will sense it and not give you the option to use pickit 2 power. for a target board not connected to an external power supply, you will see the options displayed in figure 2-5. figure 2-5: enable power from pickit? 2 to enable power to the target device, check the v dd pickit 2 ?on? checkbox as shown. the default setting is ?off?, i.e., the checkbox is unchecked. the voltage supplied to the target may be adjusted before or after enabling power by adjusting the v dd pickit 2 voltage box (figure 2-5). if a short or heavy current load is detected on the programmer-supplied v dd , then you will receive an error and v dd will be automatically disabled. refer to figure 2-6. voltage box note: if a target power supply is not detected, the pickit 2 will always supply power to the target during programming, regardless of the v dd pickit 2 ?on? checkbox state. caution the usb port current limit is set to 100 ma. if the target plus the pickit 2 exceed this current limit, the usb port may turn off. the target may be powered externally if more power is required.
pickit 2 programmer getting started ? 2008 microchip technology inc. ds51553e-page 19 figure 2-6: v dd error to avoid heavy current load errors, it is recommended to keep the target current consumption below 25 ma. large v dd capacitances should also be avoided as they slow down the v dd risetime. the allowed v dd rise time is 500 s or less. 2.5.2 target powered from external supply the target device may also be powered externally. by default, the pickit 2 will automat- ically detect an externally powered board. the heading ?v dd pickit 2? will be changed to ?v dd target?, the ?on? checkbox will be replaced by a checkbox named ?check?, and the detected v dd voltage is displayed in the grayed out voltage box as in figure 2-7. clicking the ?check? checkbox will update the detected v dd voltage displayed in the voltage box. if no v dd voltage is detected when the checkbox is clicked, then pickit 2 will return to supplying v dd power to the target device. figure 2-7: externally powered target 2.6 importing a hex file to import a compiled program (hex file) to be programmed into the target device, select file>import hex as shown in figure 2-8. figure 2-8: import hex file example source code and hex files may be found under the install\lessons\ directory for the appropriate kit demo board on the pickit 2 starter kit cd-rom. the hex file reversible.hex from the folder 07 reversible will be used. note: the maximum external v dd that may be used with the pickit 2 is 5.0 volts. the minimum external v dd that may be used with the pickit 2 is 2.5 volts.
pickit? 2 user?s guide ds51553e-page 20 ? 2008 microchip technology inc. browse for the hex file and click open . the code is displayed in the program memory and eeprom data windows. the name of the hex file is displayed in the source block under program memory. figure 2-9: example hex file imported the pickit 2 programmer application will warn you if the hex file does not contain any configuration words. you can be sure these are included in the hex file by selecting file>export in mplab ide to save a hex file including configuration memory. (for mplab ide usage, see chapter 4. ?pickit 2 debug express? .) you will also be warned that the hex file is larger than the selected device if the hex file contains memory locations that do not exist in the current device. any data for non-existent locations will not be imported. 2.7 writing the program to the device after a device family has been selected and a hex file has been imported, the target device can be programmed by clicking write (figure 2-10). the device will be erased and programmed with the hex code previously imported. note: the example lesson code is meant to be installed to the local hard drive from the cd-rom using the setup files in the cd-rom directory install/lessons/ . the lessons are covered in the user?s guide for the included kit demo board, and this guide should be read before using the lesson projects and source code.
pickit 2 programmer getting started ? 2008 microchip technology inc. ds51553e-page 21 when erasing the device during programming, a bulk erase method is used. all base- line, mid-range, and many dspic30f and pic18f devices require a minimum v dd for the bulk erase. some of these devices support a low voltage row erase method that can be used at lower voltages, but this method takes longer to erase the device. see the readme file under help>readme for devices that support this feature. if a device does not support row erasing, a dialog will pop up to warn you if the device v dd is below the minimum required for a bulk erase. figure 2-10: buttons ? write the status of the write operation is displayed in the status bar located under the device configuration window. if the write is successful, the status bar turns green and displays ?programming successful?, as shown in figure 2-11. figure 2-11: write successful status if the write fails, the status bar turns red and displays ?programming failed?, as shown in figure 2-12. this error indicates that the data was corrupted during the programming sequence. if this error is displayed, try writing the program to the device again. if the error continues, see chapter 5. ?troubleshooting? for assistance. figure 2-12: write error status other write issues may be displayed as warnings and will turn the status bar yellow as in figure 2-13. in this case, the pickit 2 and demo board had become disconnected. note: if any code protect, data protect, write protect, or read protect configu- ration bits are currently set in the device, the bulk erase method must be used prior to programming. the lower voltage row erase procedure will not succeed.
pickit? 2 user?s guide ds51553e-page 22 ? 2008 microchip technology inc. figure 2-13: write warning status 2.7.1 writing to specific memory regions if a device has eeprom data memory, the ?enabled? checkbox next to program memory and eeprom data will become available. the checkboxes select which memory regions? programming operations will be affected. refer to table 2-1 for a description of how programming operations are affected by the checkboxes. erase and blank check always operate on all memory regions. during a write, regions that are unchecked will remain unchanged in the device. for example, if program memory is unchecked while eeprom data is checked, then a write operation will only write eeprom data, while program memory, user ids and configuration words in the device will remain unchanged. if program memory is checked while eeprom data is unchecked, then a write operation will program program memory, user ids and configuration words, while eeprom data in the device will remain unchanged. due to programming constraints in some devices, the pickit 2 programmer application may read and re-write eeprom data memory during a write to preserve it. it is not allowed to have both memory regions unchecked. 2.7.2 automatic file reload prior to each write, the imported hex file time stamp is compared to the version on the disk. if the version on the disk is newer, it is reloaded. this occurs only when a hex file has been read from the disk. this feature ensures that the latest version built will be written to the device. it may be used with the tools>program on pickit button feature to program the latest mplab ide build without switching to the pickit 2 programmer software simply by pressing the pickit 2 unit push button. table 2-1: memory region selection program memory enabled eeprom data enabled write/read/verify erase/blank check checked checked all memory regions all memory regions checked ? program memory user ids configuration all memory regions ? checked eeprom only all memory regions ?? not allowed
pickit 2 programmer getting started ? 2008 microchip technology inc. ds51553e-page 23 2.8 verifying the device the verify function verifies that the program in device memory matches the hex file imported into the pickit 2 programmer application. it compares all areas of memory including program memory, data eeprom memory, id and configuration bits. to verify the code, import the hex file and click verify (figure 2-14). note that a write operation is automatically verified if programmer>verify on write is checked. figure 2-14: buttons - verify if the code is the same, the status bar turns green and displays ?device verified?. if a discrepancy is found, the status bar turns red and displays where the error is located: ?error in program memory, data eeprom memory, or configuration bits?. table 2-1 illustrates how verify is affected by the memory region checkboxes. 2.9 reading device memory to view the code written to the device, click read (figure 2-15). figure 2-15: buttons - read the code is displayed in the program memory and eeprom da ta windows for your review. if all zeros are displayed, it is possible that the device is code-protected (see section 2.10 ?code protecting the device? .) table 2-1 illustrates how read is affected by the memory region checkboxes. 2.10 code protecting the device the code and data protect functions enable the read protection features of the device. to protect the program memory code, complete the following steps: 1. import hex file. 2. select tools>enable code protect as shown in figure 2-16. 3. click write . devices that have eeprom data memory may protect it by selecting tools>enable data protect .
pickit? 2 user?s guide ds51553e-page 24 ? 2008 microchip technology inc. figure 2-16: enable code protect 2.11 erasing and blank checking the device the erase function erases the program memory, data eeprom memory, id and configuration bits, regardless of the state of the program memory and eeprom data ?enabled? checkboxes. however, this function is not normally needed since the write function performs an erase operation prior to programming the device. to erase the device, click erase (figure 2-17). figure 2-17: buttons ? erase the blank check function will read the entire device to determine if program memory, eeprom data memory, user ids and configuration bits are erased. all memory regions will be examined, regardless of the state of the program memory and eeprom data ?enabled? checkboxes. to blank check the device, click blank check (figure 2-17). 2.12 automating write/read procedures the pickit 2 programmer application has two buttons for automating multiple functions. note: if the device is read after it has been protected, the protected memory regions will display all zeros. simply unchecking ?enable code protect? will not allow you to read the region. you must erase and reprogram all device memory before you can read that memory region again. note: the pickit 2 erase function always uses the bulk erase method that requires a minimum v dd , even on devices that support row erasing for the write function. you will be warned if v dd is below the minimum for the connected device.
pickit 2 programmer getting started ? 2008 microchip technology inc. ds51553e-page 25 figure 2-18: automating buttons 2.12.1 auto import hex + write device button this features allows the pickit 2 programmer application to automatically import a hex file and write it to a connected device when the hex file is updated; for example, on a new firmware build. to use this feature, click auto import hex + write device . this will bring up an import hex file dialog defaulting to the first hex file in the file history under the file menu. after selecting a file, it will be written to the device. the pickit 2 programmer application will now monitor the selected hex file for updates. when the file has been updated (has a newer time stamp), the application will automatically re-import the hex file and write to the target device. while this feature is enabled, other programming operations are disabled. the auto import hex + write device button will remain depressed while this feature is active. to stop using this feature, click auto import hex + write device again. if an error is encountered during hex file importing or device programming, the application will automatically exit this feature mode. 2.12.2 read device + export hex file button when clicked, this button will read the target device and open an export hex file dialog. 2.13 pickit 2 calibration and unit id the pickit 2 v dd may be calibrated to account for variations in the unit hardware and the usb voltage of the port it is connected to. a unit id string may also be assigned to a pickit 2 unit to provide unique identification. 2.13.1 calibrating the pickit 2 v dd calibration allows greater accuracy both in the v dd voltage supplied to the target from pickit 2, and the voltage detected on a powered target and reported in the software. the calibration is stored in the pickit 2 unit nonvolatile memory, so the unit will remain calibrated even when used from within mplab ide. it is important to note, however, that as the calibration is dependent on the usb voltage, moving the pickit 2 unit to a different usb port, to or from a usb hub or to another computer port may invalidate the calibration. to calibrate the pickit 2 unit, a multi-meter or other means of accurately measuring voltages is required. disconnect the pickit 2 unit from the target and select too ls>c al ibrate vdd & set unit id? to bring up the calibration wizard. follow the steps in the wizard to complete the calibration process. note: even when calibrated, the pickit 2 v dd voltage is limited by the available usb port voltage. pickit 2 is unable to provide a v dd voltage greater than a schottky diode drop below the usb port voltage. this voltage can be as low as 4.2 volts, especially in laptop computer ports.
pickit? 2 user?s guide ds51553e-page 26 ? 2008 microchip technology inc. 2.13.2 the pickit 2 unit id during the calibration procedure, the pickit 2 may optionally be assigned a unit id string to identify it uniquely. once assigned, the pickit 2 unit id will display in the pickit 2 programmer software title bar, and in the status window when first connecting to the pickit 2. an example is shown in figure 2-19 where the unit id is ?lab b-1?. the unit id is also displayed in the mplab ide output window when first selecting pickit 2 as a programmer or debugger. figure 2-19: unit id
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page 27 chapter 3. using in-cir cuit serial programming ? (icsp ?) 3.1 introduction the pickit 2 development programmer/debugger can program microcontroller devices that are installed in an application circuit using in-circuit serial programming (icsp). icsp requires five signals: ?v pp ? programming voltage; when applied, the device goes into programming mode. ? icspclk or pgc ? programming clock; a unidirectional synchronous serial clock line from the programmer to the target. ? icspdat or pgd ? programming data; a bidirectional synchronous serial data line. ?v dd ? power supply positive voltage. ?v ss ? power supply ground reference. however, the application circuit must be designed to allow all the programming signals to be connected to the device without distorting the programming signals. figure 3-1 shows a typical circuit as a starting point when designing an application circuit for icsp. for successful icsp programming, the precautions in the following sections need to be followed. figure 3-1: typical icsp? application circuit note: for details on how a specific device is programmed, refer to the device programming specification available from the microchip web site at www.microchip.com . 1 2 3 4 5 6 v pp /mclr v dd v ss icspdat/pgd icspclk/pgc aux target microcontroller 470 ohm* 0.1 f* 1 2 3 4 v dd ra5 v ss ra4 ra3/mclr /v pp 8 7 6 5 pickit? 2 +5v or device +5v to application circuit isolation circuitry: resistor or schottky-type diode programming header 10k* * typical values ra0/icspdat ra1/icspclk ra2
pickit? 2 user?s guide ds51553e-page 28 ? 2008 microchip technology inc. 3.2 isolate v pp /mclr /port pin when v pp voltage is applied, the application circuit needs to take into consideration that the typical v pp voltage is +12v. this may be an issue in the following situations: if the v pp pin is used as a mclr pin the application circuit is typically connected to a pull up resistor/capacitor circuit, as recommended in the device data sheet. care must be taken so that the v pp voltage slew rate is not slowed down and exceeds the rise time in the programming specification (typically 1 s). if a supervisory circuit or a push button is interfaced to the mclr pin, it is recommended that they be isolated from the v pp voltage by using a schottky-type diode or limiting resistor as shown in figure 3-1. for more information about using supervisory circuits with icsp, see application note an820 ? system supervisors in icsp? architectures ? (ds00820). if the v pp pin is used as an i/o port pin the application circuit that connects to the i/o pin may not be able to handle the +12v voltage. it is recommended to use a schottky-type diode or limiting resistor as shown in figure 3-1 to isolate the circuitry. 3.3 isolate icspclk or pgc and icspdat or pgd pins the icspclk or pgc and icspdat or pgd pins need to be isolated from the application circuit to prevent the programming signals from being affected by the application circuitry. icspclk or pgc is a unidirection synchronous serial programming clock line from the programmer to the target. icspdat or pgd is a bidirectional synchronous serial programming data line. if the design permits, dedicate these pins for icsp. however, if the application circuit requires that these pins be used in the application circuit, design the circuitry in a manner that does not alter the signal level and slew rates. isolation circuitry will vary according to the application. figure 3-1 shows one possibility by using series resistors to isolate the icsp signals from the application circuit.
using in-circuit serial programming? (icsp?) ? 2008 microchip technology inc. ds51553e-page 29 3.4 v dd during icsp programming, the device needs to be powered in accordance with the device specification. typically, the device supply voltage is connected to the application circuit supply voltage. the application circuit can be powered by the pickit 2 or exter- nally. there are a few precautions that need to be observed in the situations covered in the following three sections. 3.4.1 the application circuit is powered by the pickit 2 the pickit 2 supply voltage may set between the maximum and minimum voltages allowed by the device programming specification, unless the minimum is below +2.5v. be sure to set the voltage box to the appropriate voltage before programming the device or turning on v dd . 3.4.2 the application circuit is powered externally the pickit 2 may be used with application circuits powered externally between +5.0v and +2.5v. 3.4.3 bulk erase is used some devices use a bulk erase function to erase program memory, data eeprom memory, id locations, and configuration bits. typically, the bulk erase function requires a supply voltage (v dd ) of 4.5 to 5.5 volts (refer to the device programming specification for device specific requirements). this voltage range can be a problem if the application circuit is designed to operate at a different supply voltage range. in order to bulk erase the device, the application circuit needs to take into consideration the bulk erase voltage requirement while protecting any voltage sensitive circuitry. if the application circuit v dd is below the minimum required for the bulk erase, a dialog will warn the user before attempting to erase the device. caution the usb port current limit is set to 100 ma. if the target plus the programmer exceeds this current limit, the usb port may turn off. the target may be powered externally if more power is required. note: current draw should be limited to 25 ma when using the programmer to power the application circuit. ensure that the application circuit does not slow the v dd rise time to longer than 500 s.
pickit? 2 user?s guide ds51553e-page 30 ? 2008 microchip technology inc. 3.5 v ss the power supply ground reference, v ss , must be at the same potential as the application circuit. 3.6 cable lengths minimize the distance the icsp signals must travel by placing the icsp connector as close to the application circuit device as possible. minimize any cable length between the pickit 2 and application circuit device. the goal is to keep the icsp signals within the level and slew rate specifications for successful programming. 3.7 serial eeprom and keeloq hcs devices the programming signals and connections for these devices are different than those for microcontrollers as described in section 3.1 ?introduction? and figure 3-1. see the pickit 2 programmer readme file, help>readme , for programming signal connectivity for these devices. additionally, these devices are not intended to be programmed in-circuit. attempting to program serial eeprom devices while in-circuit may fail due to conflicts with other devices on the serial bus.
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page 31 chapter 4. pickit 2 debug express 4.1 introduction in addition to the pickit 2 programmer application, the pickit 2 development programmer/debugger may be used with mplab ? ide, the free integrated develop- ment environment available on microchip?s website. mplab ide allows the pickit 2 to be used as an in-circuit debugger as well as a programmer (for selected devices only). in-circuit debugging allows you to run, examine and modify your program while the device is embedded in your target hardware. this greatly assists you in debugging your firmware and hardware together. special pickit 2 debug express software interacts with the mplab ide application to run, stop and single-step through programs. one or more breakpoints can be set and the processor can be reset. once the processor is stopped, the register?s contents can be examined and modified. for more information on how to use mplab ide, reference the following documentation: ? mplab ? ide user?s guide (ds51519) ? mplab ? ide quick start guide (ds51281) ? mplab ? ide on-line help 4.2 pickit 2 debug express kit contents the pickit 2 debug express kit (dv164121) contains the following items: 1. the pickit 2 development programmer/debugger 2. usb cable 3. 44-pin demo board with device* 4. pickit 2 starter kit and mplab ide cd-roms * the following boards may also be used to debug: - to use the low pin count demo board from the starter kit, the ac162061 icd header and ac164110 adapter will be required. - to use the explorer 16 board, be aware that the connector labeled ?pickit2? incorrectly shows the location of pickit 2 pin 1 on the silkscreen. that is, pin 1 is actually pin 6.
pickit? 2 user?s guide ds51553e-page 32 ? 2008 microchip technology inc. 4.3 installing the hardware and software install the pickit 2 hardware as specified in section 2.2 ?installing the pickit 2 hardware? . obtain a copy of the mplab ide software application from the microchip website or cd-rom enclosed with the kit and install it as directed. 4.4 using pickit 2 debug express 4.4.1 determining device support for a list of current devices supported by pickit 2 debug express, see the ? readme for pickit 2.htm ? file in the ?readmes? subdirectory of the mplab ide installation directory. when selecting a device as discussed in section 4.5 ?debug express tutorial? , the ?select device? dialog shown in figure 4-11 shows the level of support for the selected device by debug express. in the ?debuggers? section of the dialog, the color of the circle next to ?pickit 2? indicates the support level: red ? the device is not currently supported by pickit 2 debug express yellow ? the device has beta support in pickit 2 debug express green ? the device has full support in pickit 2 debug express beta support indicates that the device is supported, but has not yet undergone internal certification testing by microchip. 4.4.2 reserved resources due to the built-in in-circuit debugging capability of icd devices and the icsp function offered by the debugger, the pickit 2 debug express uses some on-chip resources when debugging. it also uses program memory and file register locations in the target device during debugging. these locations are not available for use by user code. in mplab ide, registers marked with an ?r? in register displays represent reserved registers. for information on device resources that are needed for in-circuit debugging, please refer to the mplab icd 2 help, found in the mplab ide under help>topics . the device reserved resource information found under ?resources used by mplab icd 2? is the same for the pickit 2 debug express. 4.4.3 using an icd header all baseline and some mid-range pic microcontrollers require a special ?icd device mounted on a debug header circuit board to enable the debugging feature. for a list of these devices and the required icd header board part number, please see the ? header board specification ? (ds51292). the header board specification is included on the pickit 2 cd-rom, and is available online at www.microchip.com. note: debug express requires 4.7k ohm pull down resistors on icspclk and icspdat. newer pickit 2 units have a red button and have the pull downs internally. older pickit 2 units have a black button and require that the pull downs be added on the target board. note: debug express requires mplab ide version 7.50 or later.
pickit 2 debug express ? 2008 microchip technology inc. ds51553e-page 33 each icd header board comes with the necessary ?icd device, and is used on the tar- get board instead of the production microcontroller. however, most header boards have an rj-11 debug connector which requires the ac164110 rj-11 to icsp adapter kit to connect it to pickit 2. figure 4-1 illustrates using the ac162061 icd header for the pic16f690 with the ac164110 adapter kit and low pin count demo board. figure 4-1: using the pic16f690 icd header board many mid-range pic microcontrollers and all pic18 and 16-bit pic microcontroller devices do not require an icd header and can be debugged directly through the icsp programming connections. this is true of the pic16f887 included on the 44-pin demo board, which can be debugged by simply connecting the demo board to the pickit 2 as shown in figure 4-2. figure 4-2: connecting the demo board to the pickit? 2 ac164110 icsp? to rj-11 adapter icd header debug target board this diagram shows how to connect the pickit? 2 to an icd header with the icsp to rj-11 adapter. the ac162061 icd header for the pic16f690 is shown, plugging into the dm164120-1 low pin count demo board. debug target board pic ? microcontrollers that dont require an icd header may be debugged directly over the in-circuit serial-programming? (icsp?) connections. the dm164120-2 44-pin demo board with pic16f887 is shown.
pickit? 2 user?s guide ds51553e-page 34 ? 2008 microchip technology inc. 4.4.4 configuration bits and debug express pic microcontroller devices that do not require an icd header and may be debugged directly contain a debug bit in the configuration word(s) that enables and disables the debug mode on the pic microcontroller. this bit is automatically set appropriately by the mplab ide when using pickit 2 debug express and should not be specified in source code configuration settings. many 16-bit pic microcontroller devices such as pic24 and dspic33 families have multiple icsp programming and debugging port pins labeled pgc1/emuc1 and pgd1/emud1, pgc2/emuc2 and pgd2/emud2, etc. while any icsp port may be used for programming, only one port is active at a time for debugging. the active emu port is set in the device configuration bits. if the active port setting does not match the emu port to which the pickit 2 is connected, the device will be unable to enter debug mode. in the mplab ide configuration bits dialog, these bits are usually referred to as the ?comm channel select? bits. 4.4.5 debug express breakpoints the number of active breakpoints supported by pickit 2 debug express depends on the target device. most baseline and mid-range devices support 1 breakpoint, with more breakpoints supported in some pic18 and 16-bit devices. the number of active breakpoints available for the current device in mplab ide can be seen by selecting debugger>breakpoints? . this will open a dialog (figure 4-3) showing any currently set breakpoints in program memory. the ?active breakpoint limit:? text box shows how many total breakpoints are available for the current device. the ?available breakpoints:? text box shows how many breakpoints are currently unused. figure 4-3: breakpoints dialog for pic16f887 some pic18 and 16-bit devices also support advanced breakpoints. advanced break- points allow breakpoints to be set in file register memory, and will halt execution when a specific file register is read from or written to. this breakpoint may also be set so it will only halt when a specific value is read from or written to a register. additionally, a caution the debug configuration bit value should not be specified in source code configura- tion settings under normal conditions. doing so may cause the bit to be asserted when programming a device outside the debugger. this will cause the device to function improperly or not all at in the application circuit.
pickit 2 debug express ? 2008 microchip technology inc. ds51553e-page 35 ?pass count? may be set on any breakpoint type. the pass count is the number of times the breakpoint condition is met before it halts execution. for example, setting a pass count of ?2? on a program memory breakpoint means that instruction will execute twice without halting execution, and the third time the instruction is executed the breakpoint will halt execution. the default pass count for all breakpoints is ?0?, which means execution will halt the first time the breakpoint is encountered. if advanced breakpoints are supported by the current device, the mplab ide menu option debugger>advanced breakpoints? will be available to open the advanced breakpoint dialog. if the current device does not support advanced breakpoints, this menu option will be grayed out or absent. select the breakpoint to edit with the ?break point #? combo box. figure 4-4: advanced breakpoints dialog 4.4.6 breakpoint skidding the in-circuit debug implementation on pic microcontrollers will halt execution on the instruction after the breakpoint instruction. this means the breakpoint instruction will have executed when the debugger halts. this is referred to as ?breakpoint skidding?. as a result, there are some breakpoint behaviors to be aware of. when a breakpoint is set on a goto , call , or return instruction, the debugger will halt at the destination instruction, as the program branch instruction with the breakpoint will have executed. also, when using the debugger step over function, a breakpoint will be set on the instruction after the call instruction that the debugger is ?stepping over? if there is an available breakpoint. if the call instruction is followed immediately by another call instruction, this will result in the debugger halting at the destination of the second call instruction. to prevent this, a nop may be placed between the call instructions. note that 16-bit devices will halt two instructions after the breakpoint instruction. note: the advanced breakpoint dialog will display any breakpoints already set in program memory. however, the dialog may not be used to set or clear breakpoints in program memory or to edit the address of an existing pro- gram memory breakpoint. only the pass count value for program memory breakpoints may be edited in the advanced breakpoint dialog. to edit, set, or clear program memory breakpoints, use the mplab ide editor or the debugger>breakpoints? menu dialog.
pickit? 2 user?s guide ds51553e-page 36 ? 2008 microchip technology inc. 4.4.7 linker scripts if your project uses a linker script, special icd linker script files must be used when debugging that reserve the resources used by the pickit 2 debug express. each device has a separate debug linker file, which contains an ?i? at the end of the device name. for example: 16f877i.lkr ? in-circuit debug linker file for the pic16f877 device 18f4520i.lkr ? in-circuit debug linker file for the pic18f4520 device when debugging with pickit 2 debug express, the icd linker file should be used instead of the standard linker file. 4.5 debug express tutorial this tutorial is intended to be used with the pickit 2 44-pin demo board and pic16f887 microcontroller. this demo board comes with the pickit 2 debug express kit and is available separately as part number dm164120-2. if this demo board is not available, it is still recommended to read through this tutorial to get an overview of using the pickit 2 as a debugger in the mplab ide. the source file used for the tutorial is installed with the pickit 2 programmer software. 4.5.1 selecting the device to select a device in mplab ide: 1. launch the mplab ide application. 2. from the mplab ide menu bar, select configure>select device (figure 4-5). figure 4-5: mplab ? ide menu bar
pickit 2 debug express ? 2008 microchip technology inc. ds51553e-page 37 3. in the select device dialog (figure 4-6), click on the ?device? drop-down list and select your device. in this tutorial, choose the pic16f887 device. figure 4-6: select device dialog 4. no other changes need to be made in this dialog box. click ok . 4.5.2 selecting pickit 2 as the debug tool 1. select debugger>select tool>pickit 2 . mplab ide will add pickit 2 debug fea- tures (figure 4-7): (a) the status bar will show pickit 2 as the debug tool, (b) a pickit 2 debug toolbar will be added, (c) the debugger menu will change to add pickit 2 debug functions and (d) the output window will display communication status between the pickit 2 and the target board on the pickit 2 tab. figure 4-7: pickit ? 2 debug tool a c d b
pickit? 2 user?s guide ds51553e-page 38 ? 2008 microchip technology inc. 2. select debugger>settings to set up pickit 2 operation. make sure the ?connect on startup? checkbox is checked to enable the auto-connection feature (figure 4-8). then click ok . figure 4-8: pickit ? 2 settings dialog 3. if the pickit 2 did not connect automatically when it was selected as the debug tool, select debugger>connect to connect now. the connection status will be visible in the output window. depending on the version of the mplab ide soft- ware or the selected device, a message may appear indicating that the firmware (pickit 2 operating system) needs to be updated. mplab ide will automatically install new firmware. 4.5.3 creating an mplab ide project an mplab ide project and workspace keep all files and settings for a development project together. the project wizard helps you set up a new project. 1. select project>project wizard to set up the project. the project wizard welcome screen will display (figure 4-9). click next to continue to step one. figure 4-9: project wizard welcome
pickit 2 debug express ? 2008 microchip technology inc. ds51553e-page 39 2. select the pic16f887 device from the ?device? drop-down box, if it is not already selected (figure 4-10). click next to continue to step two. figure 4-10: step one ? select device 3. for this project, the mpasm? assembler tool will be used. select ?microchip mpasm toolsuite? from the active toolsuite drop-down menu (figure 4-11). make sure the tools are set to the proper executables by default in the c:\program files\microchip\mpasm suite folder as follows: - mpasm assembler should be pointing to mpasmwin.exe. - mplink? object linker should be pointing to mplink.exe. - mplib? object librarian should be pointing to mplib.exe. click next to continue to step three. figure 4-11: step two ? select language suite
pickit? 2 user?s guide ds51553e-page 40 ? 2008 microchip technology inc. 4. click browse (figure 4-12) to locate or create a new project directory and project name. for this tutorial, select the location c:\program files\microchip\pickit 2 v2\dbe demo and give the project file a name, such as ? pic16f887 debug demo ?. figure 4-12: step three ? create new project 5. add the project source file (figure 4-13). from the left pane window, go to c:\program files\microchip\pickit 2 v2\dbe demo . select and highlight the 16f887demo.asm file and click add . the file will be placed into the right pane window the ?a? allows mplab ide to decide whether the path to the file should be rela- tive or absolute for the project. for a description of and how to change to other possible file-addition modes, see the mplab ide documentation. do not change the setting for this project. click next to continue to the summary window. note: other files can be added later. note: for projects containing more than one assembly file (e.g., multifile projects, c code project) you will also need to add a linker script file. see the language tool documentation for more details.
pickit 2 debug express ? 2008 microchip technology inc. ds51553e-page 41 figure 4-13: step four ? add files 6. if any errors have been made, click back to return to any of the previous steps in the project wizard (figure 4-14). otherwise, click finish . figure 4-14: project wizard summary 4.5.4 viewing the demo project after completing the project setup and exiting the project wizard, the project window will display in the mplab ide desktop window (figure 4-15). if it is not open, select view>project to open it. if needed, files can be added to or removed from the project using the project window. right click on the file in the project window tree to display a pop-up menu with options that include adding or removing files.
pickit? 2 user?s guide ds51553e-page 42 ? 2008 microchip technology inc. figure 4-15: project window file menu 4.5.5 creating a hex file to create a hex file for programming the device, you need to build the project. select project>build all , or right click on the project name in the project window and select ?build all? from the pop-up menu. the mpasm assembler will create a hex file with the same name as the source .asm file. the assembler?s progress will be visible in the build tab of the output window (figure 4-16). figure 4-16: output window ? build the project 4.5.6 checking configuration bit values the configuration bits that will be programmed into the device are set from within the program using __config directives. once the project is built, the values of these bits can be verified using the configuration bits window. select configure>configura tion bits to open the window (figure 4-17.) the following configuration bits should now be set for this tutorial: config1: ? oscillator ? internal rc no clock ? watchdog timer ? off ? power-up timer ? on ? master clear enable ? mclr is external ? code-protect ? off ? data ee protect ? off ? brown-out detect ? bod and sboren disabled ? internal-external switch over mode ? disabled ? monitor clock fail-safe ? disabled ? low-voltage program ? disabled
pickit 2 debug express ? 2008 microchip technology inc. ds51553e-page 43 config 2: ? self write enable ? no protection ? master brown-out reset sel bit ? brown-out at 2.1v figure 4-17: config uration bit settings 4.5.7 loading program code for debugging to program the device, select debugger>program to program the 16f887demo.hex file into the pic16f887 on the 44-pin demo board. programming will only take a few seconds. during programming, the pickit 2 tab of the output dialog window will display the current phase of operation. when programming is complete, the dialog should look similar to figure 4-18. figure 4-18: output window ? program device for debug note: debug executive code is automatically programmed in the upper program memory of the pic16f887 (target device) when the pickit 2 is selected as a debugger. debug code must be programmed into the target device to use the in-circuit debugging capabilities of the pickit 2.
pickit? 2 user?s guide ds51553e-page 44 ? 2008 microchip technology inc. 4.5.8 running the pic16f887 debug demo the pickit 2 debug express executes the program code in either real-time (run) or in steps (step into, step over, step out, animate.) real-time execution occurs when you select run in mplab ide. when the program is halted, either by halt or at a breakpoint, you can step through the code. the following toolbar buttons can be used for quick access to commonly used debug operations: to run the demo code: 1. double click on the 16f887demo.asm file from the project window or select file>open from the toolbar menu. the code will appear in a file window. 2. select debugger>run or click run . 3. turn the potentiometer (rp1), located on the demo board, and observe the leds. if the program were working properly, the leds would rotate faster or slower depending on in which direction the potentiometer is turned. however, a bug has been intentionally placed in the code for debugging demonstration purposes. see section 4.5.9 ?debugging the pic16f887 debug demo code? for debugging instructions. 4. select debugger>halt or click halt to stop the program execution. a green solid arrow will mark the line of code in the file window where the program halted. 5. select debugger>reset>processor reset to reset the program. the arrow will disappear, meaning the device is reset. 4.5.9 debugging the pic16f887 debug demo code any of the following issues can prevent the pic16f887 debug demo program from working properly: 1. the a/d converter value is not being written properly to the delay routine. 2. the a/d converter is not enabled or has not been set to convert. 3. a typing error in the source code has caused the program to function improperly. to explore the issue listed first, set a breakpoint at the line of code that writes the value of the a/d result to the high-order delay byte: 1. place the cursor on the following line of code in the 16f887demo.asm file: movwf delay+1 , as shown in figure 4-19. at this breakpoint, the program will stop once the a/d conversion has completed. 2. either right click on the line to display a drop-down menu and select ?set breakpoint? or double click on the line. a breakpoint symbol will appear next to the line as the letter b in a solid red octagon, as shown in figure 4-19. debugger menu toolbar buttons run halt animate step into step over step out reset
pickit 2 debug express ? 2008 microchip technology inc. ds51553e-page 45 figure 4-19: set breakpoint 3. select debugger>run , or click run to run the program. the breakpoint will stop the program?s execution when the program executes the line marked as a breakpoint. 4. mouse over adresh in the line above the breakpoint and it will show the value of the file register (figure 4-20). figure 4-20: adresh register value 5. adjust the potentiometer (rp1) and continue the program execution by selecting debug>run . the program will run through the loop and halt again. 6. mouse over adresh again to see that the a/d result has not changed. thus it seems the a/d conversion is not working. the a/d conversion initialization and setup occurs at the beginning of the program. 7. select debugger>reset to reset the program. 8. select view>watch to open a new watch window. this window will allow you to watch the a/d register value change as the program executes. the watch dialog opens with the watch 1 tab selected, as shown in figure 4-21. note: depending on the device, breakpoint halts may ?skid? past the breakpoint location. in this case, the program will halt on the line: incfsz delay,f
pickit? 2 user?s guide ds51553e-page 46 ? 2008 microchip technology inc. figure 4-21: new watch window 9. select adcon0 from the first drop-down list and then click add sfr to add adcon0 to the watch window. repeat this to add adcon1 and adresh to the watch window. the selected sfrs should be visible in the watch window as shown in figure 4-22. figure 4-22: add sfrs to watch 10. select debugger>run to the run the program. again, the program will stop after it reaches the breakpoint. 11. examine the values of the adcon0 and adcon1 registers in the watch window. the adcon0 value is ?0x40? ( b?01000000? ). this corresponds to the hex value designated in the program. however, this is not correct. a review of the ? pic16f882/883/884/886/887 data sheet ? (ds41291), analog-to-digital (a/d) converter module section, indicates that the last bit should be a ? 1 ? ( b?0100000 1 ? ) to turn on the a/d module. to fix this bug, change: movlw 0x40 to movlw 0x41 , as shown in figure 4-23. note: it is not recommended to use the view>file registers and view>special function registers windows when debugging with pickit 2 debug express. when these windows are open, the entire contents must be written then read back from the target device on every operation. this may slow down debugging operations significantly. instead, only add the sfr and file register variables of interest to a watch window as described in this tutorial.
pickit 2 debug express ? 2008 microchip technology inc. ds51553e-page 47 figure 4-23: a/d module code 12. select file>save to save your changes. 13. you must rebuild the project and reprogram the device for the changes to take effect. select project>build all to rebuild the project and then select debugger>program to reprogram the device using the pickit 2. 14. select debugger>run to the run the program. again, the program will stop after it reaches the breakpoint. 15. examine the values in the watch window. this time, adcon0 should be 0x41 (figure 4-24). figure 4-24: adcon correct value 16. right click on the line of code that marked by the breakpoint and select remove>breakpoint or double click on the line to remove the breakpoint. 17. select debugger>run to run the program real-time. turn the potentiometer (rp1) to change the value displayed on the leds. now it works! the source code in this tutorial contained only one bug. however, real code may have more. using mplab ide with pickit 2 debugging functions, you can successfully find and fix problems in your code.
pickit? 2 user?s guide ds51553e-page 48 ? 2008 microchip technology inc. 4.5.10 programming the debugged application when the program is successfully debugged and running, the next step is to program the device for stand-alone operation in the finished design. when doing this, the resources reserved by the icd are released for use by the application. to program the application, use the following steps: 1. disable pickit 2 as a debug tool by selecting debugger>select tool>none . 2. select pickit 2 as a programmer in the programmer>select programmer menu. 3. optional: set up the id in configure>id memory (figure 4-25). figure 4-25: user id memory 4. set up the parameters for programming on the programmer>settings , program tab. 5. select programmer>program . now the target will run independently.
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page 49 chapter 5. troubleshooting 5.1 introduction this chapter describes questions and answers to common problems associated with using the pickit 2 development programmer/debugger. it also gives information on the pickit 2 debug express mplab ide errors. ? frequently asked questions ? pickit 2 debug express mplab ide errors 5.2 frequently asked questions ? d evice is no t re cognized ? current limit exceeded ? microsoft windows driver ? verify and read return al l zeros ? microsoft windows 95/98/nt ? v dd /v pp errors ? programming errors ? windows error: unrecognized usb device ? pickit 2 not found ? pickit 2 programmer application locks up ? low pin count demo board push bu tton not working ? using the demo board lessons ? programming fails on configuration ? unable to program pic10f devices ? the pickit 2 aux pin ? picki t2 h ex file format ? window display problems ? memory locations are marked ?rr? ? debug express is slow ? debug express overshoots breakpoint device is not recognized question why am i receiving a ? no device found ? message? answer verify that the device is supported and that the target mcu is connected to the pickit 2 in accordance with chapter 3. ?using in-circuit serial programming? (icsp?)? . verify that pic18fxxjxx, pic24x, and dspic33f devices have an appropriate capacitance on the v ddcore /v cap pin in accordance with the device data sheet. verify that the device is a member of the currently active family displayed at the top of the status window. select the correct family from the device family menu if needed. see also the programming fails on configuration topic.
pickit? 2 user?s guide ds51553e-page 50 ? 2008 microchip technology inc. current limit exceeded question why am i receiving the error message ? usb hub current limit exceeded ? from the microsoft ? windows ? program? answer verify that the application circuit is not drawing more than 25 ma from the pickit 2. microsoft windows driver question after plugging the pickit 2 unit into the usb port, windows 98 se asks for a driver. where is the driver? answer the pickit 2 uses the drivers included with windows 98 se. when windows 98 se prompts for a driver, select ? search for the best driver for your device .? then select the checkbox next to ? microsoft windows update ? and click next . windows os will automatically install the appropriate driver. do not use microchip?s mplab icd 2 usb device driver. verify and read return all zeros question when verify or read are clicked, the program memory window comes up with all zeros. what is wrong? answer the device may be code-protected. ensure code protection has not been selected in the configuration word. microsoft windows 95/98/nt question can i run on windows 95/98/nt ? answer no. these operating systems either do not support usb or have drivers that are not compatible. v dd /v pp errors question why do i keep getting a ?v dd error? or ?v pp error?? answer this error indicates that the pickit 2 is not able to drive v dd or v pp to the intended volt- age. check the circuit board for shorts, for large current draw and verify that the target device is connected to the pickit 2 in accordance with chapter 3. ?using in-circuit serial programming? (icsp?)? . make sure that v dd capacitance is not reducing the v dd rise time longer than 500 s.
troubleshooting ? 2008 microchip technology inc. ds51553e-page 51 programming errors question why am i able to program some parts but not others? answer if some parts are configured for low-voltage programming, a floating pgm pin can interfere with programming. use a resistor to pull this pin low when programming. some mid-range parts, such as the pic16f72/73/74/76/77 family and pic16f737/747/767/777 family require a minimum programming v dd of +4.75v. depending on the usb voltage, the pickit 2 may not be able to supply +4.75v on v dd . program these parts using an external +5.0v power supply. some pic18f parts require significant bypass capacitance on v dd . try increasing the total bypass capacitance up to 10 uf. pic18fxxjxx, pic24x, and dspic30f/33f devices require a 4.7 uf capacitor on the v ddcore /v cap pin in order to function properly. if not using a separate regulator to sup- ply v ddcore , ensure that the envreg pin is tied to v dd . windows error: unrecognized usb device question why do i get an ?unrecognized device? error when plugging my pickit 2 into usb? answer this error may occur if pickit 2 is plugged into usb while connected to a target circuit board. when plugging pickit 2 in a pc, restarting or booting up a pc, ensure the pickit 2 is not connected to a target device. this error may also occur when pickit 2 is used with some usb hubs. if the pickit 2 is plugged into a usb hub port, try plugging the pickit 2 directly into a pc usb port. pickit 2 not found question i have my pickit 2 plugged into usb, but the pickit 2 programmer application keeps saying ?pickit 2 not found? answer please see the answer for windows error: unrecognized usb device . pickit 2 programmer application locks up question why is the pickit 2 programmer window locking up? answer often times, the software hasn?t truly locked up. during a programming operation the pickit 2 application user interface is inactive. until the programming operation is com- plete, the windows os may stop updating the pickit 2 if another application is brought into focus or the pickit 2 has just been brought back into focus. once the programming operation is complete, the application window will update. for large memory parts, pro- gramming may take several minutes. for 8-bit devices, try waiting at least 2 minutes before concluding the software has truly locked up. for 16-bit devices, try waiting 5 minutes for the operation to complete.
pickit? 2 user?s guide ds51553e-page 52 ? 2008 microchip technology inc. there are a few usb controller chipsets that appear to cause lockup problems with the pickit 2, which seem to be more common in laptops. this can usually be worked around by connecting a usb hub between the pc and the pickit 2 unit, or using a usb cardbus adapter. using a usb hub with an external power supply is recommended. low pin count demo board push button not working question when i run the low pin count demo board lessons, why doesn?t the push button work? answer when programming the lessons from within mplab ide, the ide always maintains an output voltage on the pickit 2 mclr -v pp pin. on the low pin count and 28-pin demo boards, the push button signal is connected to the mclr signal. the pickit 2 output interferes with the push button signal. use the pickit 2 programmer software application to program and run the low pin count demo board lessons. additionally, future versions of the mplab ide will optionally allow the mclr -v pp pin to be tri-stated when the device is ?released from reset?. check programmer>set tings for this option. note that this option would not apply during debugging. using the demo board lessons question where are the included lessons? is there any documentation on them? answer the starter kit and debug express kit lessons may be installed from the included pickit 2 cd-rom. the lessons will be installed to the local hard drive under c:\pk2 lessons\ . the documentation for the lesson projects is in the user?s guide for the included demo board. for the starter kit, see the ?low pin count demo board user?s guide? (ds51556). for the debug express kit, see the ? 44-pin demo board user?s guide? (ds41296). both of these documents may be opened from the pickit 2 programmer help menu. programming fails on configuration question why does programming a device always fail on the configuration word(s), after which pickit 2 won?t recognize the device? answer this may be caused by a configuration setting or program code that affects the icsp pgd and pgc pins. this interference can prevent the target pic mcu from entering programming mode. check the menu option tools>use vpp first program entry when attempting a pro- gramming operation on these devices. this program mode entry will usually get around the problem, but it requires that the target device be powered from the pickit 2 unit v dd pin.
troubleshooting ? 2008 microchip technology inc. ds51553e-page 53 unable to program pic10f devices question why won?t my pic10f parts program in the low pin count demo board? answer the low pin count demo board supports 8-pin devices. the pic10f parts are 6-pin devices, even though they can be ordered in an 8-pin dip. the pic10f pinout is not compatible with the low pin count demo board. instead, the ac163020 pic10f2xx programming adapter should be used. the pickit 2 aux pin question what is the aux pin for? how do i connect it? answer the pickit 2 aux pin is not used for programming pic microcontrollers, and should be left unconnected. the aux pin is only used when programming some serial eeproms. see the pickit 2 readme file ( help>readme ) for eeprom connection information. pickit 2 hex file format question what hex file format does the pickit 2 programmer application use? answer the pickit 2 programmer application uses the intel hex 32 format, often referred to as inhx32. however, pickit 2 does not support record types 03 and 05. least significant bytes are at lower hex file addresses (little endian format). window display problems question why is the pickit 2 programmer application displaying program memory and/or eeprom data locations as all periods ???? why can?t i close the help>about dialog? answer these issues are frequently caused by non-standard monitor dpi settings. this can be corrected by setting the dpi to the normal setting, 96 dpi. to do this 1. right click on the windows desktop background and select properties from the pop-up menu. this will open the display properties dialog. 2. in the display properties dialog, select the settings tab. 3. on this tab, click advanced to open the monitor dialog. 4. in the monitor dialog, select the general tab. 5. on this tab, change the ?dpi setting:? to ?normal size (96 dpi) 6. click apply , then the ok button to close the dialog. 7. click ok to close the display properties dialog. it may be necessary to restart the pc for the changes to take effect.
pickit? 2 user?s guide ds51553e-page 54 ? 2008 microchip technology inc. memory locations are marked ?rr? question why does the file register window or program memory show some locations marked with ?rr?? answer these are locations that are reserved by icd debuggers including pickit 2 debug express during debugging for the debug executive. see section 4.4.2 ?reserved resources? . debug express is slow question why is debugging with pickit 2 so slow? answer opening the view>file register s or view>special function registers windows in the mplab ide can significantly slow down debugging, due to the volume of information being exchanged though the debugger. use a watch window instead as discussed in section 4.5.9 ?debugging the pic16f887 debug demo code? . the debug interface is also directly affected by the target device oscillator speed. when debugging with an oscillator less than 1 mhz, a slowdown in debugging performance may be noticed. debug express overshoots breakpoint question why isn?t pickit 2 debug express stopping on the breakpoint instruction? answer this behavior is referred to as ?breakpoint skidding? and is covered in section 4.4.6 ?breakpoint skidding? . 5.3 pickit 2 debug express mplab ide errors pk2error0002: allocation failure (component) pk2error0003: missing component (component) pk2error0005: failed to acquire component (component, hresult) pk2error0006: failed external call (component, method, hresult) description : an error occurred initializing a pickit 2 component, during an internal operation, or when communicating with the mplab ide environment. the most probable cause is an incomplete or corrupted installation. suggested actions: 1. uninstall all versions of mplab ide from the pc. 2. reinstall the desired mplab ide version. 3. if the problem persists contact microchip. pk2error0008: read failure (getlasterror ) pk2error0009: write failure (getlasterror ) description : mplab ide was unable to communicate with the pickit 2. possible causes include the pickit 2 not enumerating properly on usb, a target board causing a usb overcurrent condition or problems with a usb hub.
troubleshooting ? 2008 microchip technology inc. ds51553e-page 55 suggested actions : ensure the target board does not pull more than 25 ma of current from the pickit 2. if it does, use an external power supply with the target board. a target board may interfere with pickit 2 enumerating on usb. when connecting pickit 2 to a usb port, booting or restarting a connected pc, ensure the pickit 2 is dis- connected from the target board. if the pickit 2 is connected to a usb hub, try connecting the pickit 2 directly to a pc usb port. when using pickit 2 as a programmer or debugger in the mplab ide, do not run the pickit 2 programmer application or pk2cmd at the same time. if the problem persists, try connecting to pickit 2 using the pickit 2 programmer application. pk2error0010: failed to unload pickit 2 description : mplab ide was unable to disconnect from pickit 2 as a debugger or programmer when switching to the other tool mode. suggested actions : disconnect the pickit 2 from usb, reboot the computer, then reconnect pickit 2 to usb (ensure the pickit 2 is not connected to a target board.) if the problem persists contact microchip. pk2error0011: pickit 2 is already busy. unable to perform requested task. description : pickit 2 debug express has been asked to perform an operation while it is busy servicing a prior request. for example, a programming operation may still be process when a debug step operation is attempted. suggested actions : this situation will not normally happen as the user interface is disabled while pickit 2 is servicing requests. wait for the original operation to complete. pk2error0012: unable to open file (filename) description : pickit 2 debug express was unable to open the specified file. suggested actions : ensure the file exists, and file or directory permissions do not pre- vent access to the file. this may also be caused by an incomplete or corrupted installation. see pk2error0002 suggested actions . pk2error0013: bad hex line (file - line) pk2error0014: invalid address in hex file (file - line - address) description : pickit 2 debug express detected an error in a debug executive hex file. suggested actions : since all debug executive hex files are provided by microchip, the issue is most likely a corrupted installation. see pk2error0002 suggested actions . pk2error0015: failed windows call (winfunc - getlasterror) description : a call to a windows function within pickit 2 debug express has failed. this internal error is primarily meant for debugging purposes. suggested actions : this may be caused by existed system resources or a corrupted installation. 1. try rebooting your system to free up memory. 2. make sure you have a reasonable amount of free space on your hard drive, and that it is not overly fragmented. 3. see pk2error0002 suggested actions for a corrupted installation.
pickit? 2 user?s guide ds51553e-page 56 ? 2008 microchip technology inc. pk2error0016: failed to find firmware files (mplabdir ) description : pickit 2 debug express was unable to find the pickit 2 operating system firmware files. suggested actions : this is likely caused by an incomplete or corrupted installation. see pk2error0002 suggested actions . pk2error0017: invalid hex file (filename - start - end) description : pickit 2 debug express detected an error in a pickit 2 operating system hex file. suggested actions : since all operating system hex files are provided by microchip, the issue is most likely a corrupted installation. see pk2error0002 suggested actions . pk2error0018: unable to enter bootloader description : pickit 2 debug express was unable to access the pickit 2 unit bootloader while updating the pickit 2 operating system. suggested actions : disconnect the pickit 2 unit from usb and the target board. while holding the pickit 2 unit push button down, plug the pickit 2 unit back into the usb port. the busy led should flash slowly. if it does not, the bootloader may be corrupted. contact microchip about the problem. pk2error0019: failed pickit os read ([1] - [2] - [3] - [4]) description : an error occurred while communicating with the pickit 2 bootloader. suggested actions : remove the pickit 2 unit from usb and the target board, reboot the pc, reconnect the pickit 2 unit to usb and retry the operation. if this does not work, try updating the firmware using the pickit 2 programmer application. pk2error0020: failed pickit os verify (address - read - expected) description : the download of a pickit 2 operating system to the pickit 2 unit failed. suggested actions : remove the pickit 2 unit from usb and the target board, reboot the pc, reconnect the pickit 2 unit to usb and retry the operation. if this does not work, try updating the firmware using the pickit 2 programmer application. pk2error0021: unable to exit bootloader description : pickit 2 debug express failed to exit the pickit 2 bootloader mode after downloading a pickit 2 operating system to the unit. suggested actions : remove the pickit 2 unit from usb and the target board, reboot the pc, reconnect the pickit 2 unit to usb and retry the operation. if this does not work, try updating the firmware using the pickit 2 programmer application. pk2error0022: pickit 2 not found description : mplab ide is not able to detect the pickit 2 device on any usb port. suggested actions : see pk2error0008 suggested actions . pk2error0023: target v dd measured at x.xv which is outside the operational range of this device (minv - maxv) description : the target power supply is outside the voltage range supported by pickit 2 for the current device. this may be due to device bulk erase limitations or pickit 2 hardware limitations.
troubleshooting ? 2008 microchip technology inc. ds51553e-page 57 suggested actions : use a target v dd voltage within the given range. if the target v dd is close to one limit but within the given limits and this error appears, try calibration the pickit 2 unit with the pickit 2 programmer software so the target voltage is read more accurately. pk2error0024: pickit 2 was unable to establish a valid v dd on the target (attempted v - read v) description : pickit 2 was unable to provide the intended v dd voltage to the target. this is usually caused by a heavy v dd load. suggested actions : power the target board externally, and/or try calibrating the pickit 2 unit with the pickit 2 programmer software. pk2error0025: failed to load pickit 2 description : pickit 2 debug express encountered a fatal error while attempting to load in the mplab ide. suggested actions : this is likely caused by an incomplete or corrupted installation. see pk2error0003 suggested actions. pk2error0027: failed verify (address - expected value - value read) description : a verify operation failed. the error message specifies the memory type and address involved, and gives the expected value and the value actually read. a ver- ify operation on a previously programmed and code protected part will fail, as the code protection feature returns all zeroes when the memory is read. suggested actions : ensure the device is not code protected. check the icsp connec- tions as described in chapter 3. ?using in-circuit serial programming? (icsp?)? . if the target device has av dd and av ss pins, check that these are properly connected. verify that pic18fxxjxx, pic24x, and dspic33f devices have an appropriate capac- itance on the v ddcore /v cap pin in accordance with the device data sheet. some pic18f devices may require up to 10 uf of capacitance on the v dd pin to program properly. pk2error0028: unable to enter debug mode description : pickit 2 debug express is unable to connect to the debug executive in the target device. suggested actions : common reasons for this error: 1. if the target is a baseline or mid-range device (pic10f, pic12f, pic16f) it may require an icd header to debug with. see section 4.4.3 ?using an icd header? . 2. the device oscillator is not working. check the configuration bits and ensure the device has a working oscillator. 3. make sure to select debugger>program in mplab ide before trying to run or step your code. 4. if you have a pickit 2 with a black colored push button, you may need pull-down resistors to debug reliably. see section 4.3 ?installing the hardware and software? . 5. the target board is not powered or is not powered properly. check the power supply. 6. the pickit 2 v dd output pin has not been connected to the target board. even if note: pickit 2 debug express will terminate the verify operation upon the first incorrect value read from the target. only this first incorrect value will be reported. there may be others.
pickit? 2 user?s guide ds51553e-page 58 ? 2008 microchip technology inc. the target board has its own power supply, this pin must always be connected to the target v dd supply. 7. the pickit 2 unit has become disconnected from the target board or has an inter- mittent connection on one or more pins. check the pickit 2 connections to the target board. 8. the incorrect linker script was used. the ?-i? icd linker script must be used when debugging. (for example, 16f887i.lkr must be used instead of 16f887.lkr). 9. the target application is attempting to use resources reserved for the debug executive, causing the debug executive to become corrupted. for example, the target application is writing to a reserved file register. see section 4.4.2 ?reserved resources? . 10. for pic24 and dspic ? dsc devices, the incorrect pgxn/emuxn port is selected in the ?comm channel select? configuration bits. check that the port the pickit 2 debug express is connected to is selected. 11. a configuration setting may be preventing the target from operating properly and executing code. the target will not enter debug mode if it is unable to execute code. 12. the device is code-protected. check configuration bits for code protect settings. 13. an operation may be attempting in an invalid context. for example, pickit 2 debug express cannot set a breakpoint if the target application is currently running. pk2error0029: failed pickit 2 operation description : pickit 2 debug express failed to complete a debug operation, such as a ?halt? or ?step? operation. suggested actions : see pk2error0028 suggested actions . pk2error0030: failed to read target file registers description : pickit 2 debug express was unable to complete a read of one or more target file registers. suggested actions : see pk2error0028 suggested actions . pk2error0031: i/o operation timeout description : a pickit 2 usb operation timed out. suggested actions : try the operation again. if it continues to fail, remove the pickit 2 unit from usb and the target board, reboot the pc, reconnect the pickit 2 unit to usb and retry the operation. if this does not work, try updating the firmware using the pickit 2 programmer application. pk2error0032: failed blank check ( address - expected value - value read ) description : a blank check operation failed. the error message specifies the memory type and address involved, and gives the expected blank value and the value actually read. suggested actions : try erasing the device. if the device is not blank after an erase check the icsp connections as described in chapter 3. ?using in-circuit serial pro- gramming? (icsp?)? . if the target device has av dd and av ss pins, check that these are properly connected. verify that pic18fxxjxx, pic24x, and dspic33f devices note: pickit 2 debug express will terminate the blank check operation upon the first incorrect value read from the target. only this first incorrect value will be reported. there may be others.
troubleshooting ? 2008 microchip technology inc. ds51553e-page 59 have an appropriate capacitance on the v ddcore /v cap pin in accordance with the device data sheet. some pic18f devices may require up to 10 uf of capacitance on the v dd pin to erase properly. pk2error0033: user aborted operation description : this error is usually given if pickit 2 debug express has popped up a warning and the user opted to cancel the current operation. for example, pickit 2 debug express may warn that a debug target cannot be programmed with the mclr pin disabled. if the user clicks cancel in the warning dialog, the programmed operation will be aborted with this error. suggested actions : none. pk2error0034: failed to initialize description : a pickit 2 debug express component was unable to complete its initialization sequence. suggested actions : this is likely caused by an incomplete or corrupted installation. see pk2error0002 suggested actions . pk2error0035: failed to retrieve xml data (node) pk2error0036: failed to open pk2 script file (filename) pk2error0037: pk2 script file structure size mismatch (struct internal size file size) pk2error0038: unable to fit block in io buffer (memtype direction blocksize) description : pickit 2 debug express internal error. suggested actions : this is likely caused by an incomplete or corrupted installation. see pk2error0002 suggested actions . pk2error0039: not halted in debug executive description : an operation was attempted that can only be completed when the target is halted while the target is running application code. this may occur if pickit 2 debug express is unable to halt the target. suggested actions : halt the target before attempting the operation again. pk2error0040: operation not supported for current device description : the attempted debug operation is not supported for the current target. suggested actions : none. pk2error0041: failed to create stream pk2error0042: failed stream read pk2error0043: failed istream write pk2error0044: failed istream open pk2error0045: no statstg pk2error0046: failed istream read pk2error0047: failed stream write description : pickit 2 debug express internal error. suggested actions : this is likely caused by an incomplete or corrupted installation. see pk2error0002 suggested actions .
pickit? 2 user?s guide ds51553e-page 60 ? 2008 microchip technology inc. notes:
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page 61 chapter 6. updating the pickit 2 operating system 6.1 introduction how to update the operating system (firmware) for the pickit 2 development programmer/debugger is described here. ? updating the pic kit 2 os - pic kit 2 programmer application ? updating the pic kit 2 os ? m plab ide 6.2 updating the pickit 2 os - pickit 2 programmer application when the pickit 2 programmer application is launched, it will check the firmware ver- sion of the pickit 2 to see if it is the latest version. if not, it will attempt to automatically download the latest version (figure 6-1). figure 6-1: update pickit? 2 os warning if there is an error in the automatic download, if you need a different operating system (os), or if you have been instructed to do so, you may manually update the os. to update the pickit 2 firmware/os manually, complete the following steps: 1. download the latest pickit 2 firmware/os from the microchip web site at www.microchip.com and place the file in the pickit 2 installation directory. by default, the location is: c:\program files\microchip\pickit 2 v2
pickit? 2 user?s guide ds51553e-page 62 ? 2008 microchip technology inc. 2. select tools>download pickit 2 operating system as shown in figure 6-2. figure 6-2: download pickit? 2 os 3. browse to the directory where the latest firmware/os file was saved. 4. select the pk2*.hex file and click on the open button. the progress of the os update will be displayed in the status bar of the program- ming software and the busy led on the pickit 2 will flash. when the update completes successfully, the status bar will display ?operating system verified? and the busy led will go out. the firmware/os update is then complete. 6.3 updating the pickit 2 os ? mplab ide when pickit 2 is chosen as either the debug tool or programmer in mplab ide, mplab ide will check the firmware version of the pickit 2 to see if it is the latest ver- sion. if not, it will attempt to automatically download the latest version. its progress is recorded in the output window on the pickit 2 tab (figure 6-3). figure 6-3: update pickit? 2 os progress if there is an error in the automatic download, if you need a different operating system (os), or if you have been instructed to do so, you may manually update the os. to update the pickit 2 firmware/os manually, complete the following steps: 1. download the latest pickit 2 firmware/os from the microchip web site at www.microchip.com and place the file in the pickit 2 installation directory. by default, the location is: c:\program files\microchip\mplab ide\pickit 2 2. select pickit 2 as the debug tool ( debugger>select tool>pickit 2 ) or program- mer ( programmer>select programmer>pickit 2 ).
updating the pickit 2 operating system ? 2008 microchip technology inc. ds51553e-page 63 3. select debugger>download os or programmer>download os as in figure 6-4. figure 6-4: download pickit? 2 os from mplab ? ide 4. mplab ide will proceed to download the latest firmware/os file to the pickit 2. the progress of the os update will be displayed in the output window, pickit 2 tab, and the busy led on the pickit 2 will flash. when the update completes suc- cessfully, the text in the pickit 2 tab will state that ?pickit 2 ready? and the busy led will go out. the firmware/os update is then complete.
pickit? 2 user?s guide ds51553e-page 64 ? 2008 microchip technology inc. notes:
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page 65 chapter 7. pickit 2 uart tool 7.1 introduction the pickit 2 programmer application versions 2.40 and later include the uart tool feature. this feature allows pickit 2 to be used as a serial uart terminal interface for communicating with a pic microcontroller. potential uses include: ? displaying debug text output from the microcontroller ? logging microcontroller data to a text file ? developing and debugging a microcontroller uart interface ? interfacing with and sending commands to the microcontroller during development the tool supports full duplex asynchronous serial communications from 150 to 38400 baud, including custom non-standard baud rates. the pickit 2 connects via the icsp connector directly to microcontroller tx and rx pins at logic levels. no transceiver is needed. 7.2 connecting the pickit 2 uart tool the pickit 2 connects to the target serial port target as shown in figure 7-1. the pickit 2 tx signal (out) should connect to the target rx signal (in), and the pickit 2 rx signal (in) should connect to the target tx signal (out). when being used with the uart tool, the pickit 2 may not be able to supply v dd volt- age to the target depending on the application version. see the version release notes in the pickit 2 readme file. however, even when pickit 2 is not supplying the target v dd , the pickit 2 v dd pin must be connected to the target v dd voltage or it will not be able to communicate. the pickit 2 uart tool will work with target v dd voltages from 2.5 volts to 5.0 volts. figure 7-1: pickit? 2 uart tool 1 2 3 4 5 6 * the 6-pin header (0.100" spacing) accepts 0.025" square pins. pin description* 1 = no connect 2 = v dd target 3 = v ss (ground) 4 = rx (pickit 2 in) 5 = tx (pickit 2 out) 6 = no connect pin 1 indicator
pickit? 2 user?s guide ds51553e-page 66 ? 2008 microchip technology inc. the format of the serial signals on pins 4 and 5 is inverted such that a start bit = logic low (v ss ), and a stop bit = logic high (v dd ). the serial data format is always 8 data bits, no parity, with one stop bit. the busy led on the pickit 2 unit acts as an activity light for the serial connection. 7.3 the pickit 2 uart tool window to open the pickit 2 uart tool window, select tools>uart tool? (figure 7-2). the pickit 2 programmer window will open and the pickit 2 programmer application win- dow will close, as the programmer cannot be used while the uart tool is active, and vice versa. figure 7-2: pickit? 2 uart tool window ascii mode the uart tool has two modes: ascii and hex. the current mode is selected and dis- played by the buttons on the upper right hand of the display. the button corresponding to the active mode will be displayed depressed. for example, in figure 7-2 the ascii mode is active and so the ascii button appears pressed. the mode selection affects how serial data is displayed and entered in the window, and the modes are explained in the next two sections. note: even though pickit 2 may not supply the target v dd , the pickit 2 v dd pin must be connected to the target v dd voltage or it will not be able to communicate. caution the pickit 2 uart tool is intended for use at logic level signals only. do not connect the pickit 2 uart tool to rs-232 +/- 12 volt signals! doing so may cause damage to the pickit 2 unit, your computer usb ports and the target serial port.
pickit 2 uart tool ? 2008 microchip technology inc. ds51553e-page 67 the window may be resized by clicking and dragging on the lower right corner of the window. 7.3.1 setting the baud rate and connecting the baud rate may be selected from the combo box in the upper left corner of the uart tool window. several common baud rates are listed, and by selecting ?custom?? any baud rate from 150 to 38400 in 1 baud increments may be used (figure 7-3). figure 7-3: baud rate selection once a custom baud rate has been set, it will be available as the last item in the baud rate selection box (figure 7-4). only one custom baud rate may be set at a time. select ?custom?? again to change the custom baud rate. figure 7-4: custom 14400 baud rate after selecting the baud rate, click connect to enable the uart tool serial interface at the selected baud. once the serial interface has been enabled, it may be disabled by clicking disconnect . the baud rate may only be changed while the interface is disconnected. 7.3.2 ascii mode when ascii mode is selected, serial bytes received from the target?s uart are dis- played as ascii characters in the main window terminal display. all bytes are displayed consecutively. to display a new line, the target uart must transmit the character val- ues 0x0d (carriage return) and 0x0a (line feed) in sequence. if one of these values is sent, or they are sent in reverse order, the character(s) will appear as an unprintable character (box) in the display. bytes may be transmitted in three ways: 1. click on the terminal display to select it. any characters typed on the pc keyboard will be immediately transmitted out of pickit 2. 2. right click on the terminal display and select paste from the pop-up menu to paste any previous copied or cut text. + may also be used. any pasted data will immediately be transmitted out of pickit 2. 3. use the ?string macros? at the bottom of the window.
pickit? 2 user?s guide ds51553e-page 68 ? 2008 microchip technology inc. no transmitted characters will be displayed if the ?echo on? checkbox is unchecked. check this box to display transmitted characters along with received characters in the terminal display. the ?string macros? at the bottom of the display allow up to four strings of characters to be entered. each string can be up to 60 characters long. when send next to a string is clicked, the entire string will be transmitted in sequence out of the pickit 2. the ?string macros? strings are saved even when the uart tool is not in use. when checked, the ?append cr+lf? checkbox above the string macro boxes will auto- matically transmit the carriage return (0x0d) and line feed (0x0a) characters at the end of a string when send is clicked. when unchecked, nothing is transmitted after the string characters. text in the terminal display may be selected (highlighted) with the cursor and copied into the clipboard by right clicking and selecting copy or pressing + . 7.3.3 hex mode the uart tool hex mode displays the hex values of bytes received from the target?s uart in the terminal display. a line of bytes received by the uart tool is preceded with the text ?rx:?. a line of bytes transmitted by the uart tool is preceded with the text ?tx:?. in figure 7-5, the four hex bytes 0x50, 0x4b, 0x53, and 0x41 were received from the target (0x50 was received first). the three bytes 0x70, 0x6b, and 0x32 were then transmitted, 0x70 first. in hex mode, bytes may only be transmitted one way: by typing a sequence of one or more hex values in one of the four ?send hex sequences:? boxes. to send a sequence, click send next to it. a hex sequence may contain from 1 to 48 bytes. the ?echo on? checkbox has no function in hex mode. data in the terminal display may be selected (highlighted) with the cursor and copied into the clipboard by right clicking and selecting copy or pressing + .
pickit 2 uart tool ? 2008 microchip technology inc. ds51553e-page 69 figure 7-5: pickit? 2 uart tool window hex mode 7.3.4 wrap text this checkbox affects both modes, ascii and hex. when checked, a displayed line will automatically wrap at the right edge of the terminal display. if unchecked, then a received line will not wrap and a horizontal scroll bar will appear in the terminal display to allow the entire line to be viewed. the terminal display will keep the last 200 lines of received data in the buffer. the ver- tical scroll bar may be used to view previous data or text. 7.3.5 log to file the log to file button allows all text and data to be saved to a text file as it appears on the display. click log to file to bring up a save file dialog. specify the file location and name and click save . while the terminal display is being saved to the log file, the log to file button will turn green and display the text ?logging data??. (figure 7-6) figure 7-6: log to file is active
pickit? 2 user?s guide ds51553e-page 70 ? 2008 microchip technology inc. to stop logging data from the display and close the log file, click logging data? . 7.3.6 clear screen clear the clear screen button to clear all text or data from the terminal display window. if data is being logged to a file, clearing the screen will not affect the log file. 7.3.7 exit uart tool click exit to close the uart tool window and return to the pickit 2 programmer application main window. the uart tool terminal display data and settings will be preserved during any programming operations until the uart tool is re-entered. if the pickit 2 application is closed, the uart tool settings, including string macros and hex sequences, will be saved and restored for the next time the uart tool is used. the terminal display buffer text and data is not saved when the application is closed. note: only data appearing on the display after the log file is opened will be written to the log file. existing data is not saved. to save existing data, use copy and paste.
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page 71 appendix a. mplab ide reference a.1 introduction in mplab ide, you first select a pickit 2 supported device and then ?pickit 2? from either the debugger or programmer menu to add debugging or programming functions to mplab ide, respectively. the functions made available are summarized here. for more information about using the pickit 2 development programmer/debugger with mplab ide, see chapter 4. ?pickit 2 debug express? . ? d ebugging functions ? programming functions ? settings dialog in addition, ?pickit 2? will be added to the mplab ide status bar, and a pickit 2 tab will be added to the output dialog. see also chapter 5. ?troubleshooting? for faqs on using pickit 2 debug express and descriptions of pickit 2 mplab ide error codes. a.2 debugging functions when you select pickit 2 from the debugger menu, debug items will be added to the following mplab ide functions: ? debugger menu ? right mouse button menu ? t oolbars a.2.1 debugger menu run f9 execute program code until a breakpoint is encountered or until halt is selected. execution starts at the current program counter (as displayed in the status bar). the current program counter location is also represented as a pointer in the program memory window. while the program is running, several other functions are disabled. animate animate causes the debugger to actually execute single steps while running, updating the values of the registers as it runs. animate runs slower than the run function, but allows you to view changing register values in the special function register window or in the watch window. to halt animate, use the menu option debugger>halt , the toolbar halt or . halt f5 halt (stop) the execution of program code. when you click halt, status information is updated.
pickit? 2 user?s guide ds51553e-page 72 ? 2008 microchip technology inc. step into f7 single step through program code. for assembly code, this command executes one instruction (single or multiple cycle instructions) and then halts. after execution of one instruction, all the windows are updated. for c code, this command executes one line of c code, which may mean the execution of one or more assembly instruction, and then halts. after execution, all the windows are updated. step over f8 in c code, steps over the current line of code. step out not available. reset f6 issue a reset sequence to the target processor. this issues a mclr to reset the program counter to the reset vector. breakpoints open the breakpoint dialog. set, enable or disable breakpoints in this dialog. for more information on this dialog, see the mplab ide on-line help file. program download your code to the target device. read read target memory. information uploaded to mplab ide. read eedata read target eedata memory. information uploaded to mplab ide. connect attempt to establish or re-establish communications between the pc and pickit 2. the progress of this connection is shown on the pickit 2 tab of the output dialog. download os download the latest pickit 2 operating system. settings open the pickit 2 settings dialog (see section a.4 ?settings dialog? .) set up automatic options and enable/disable warnings. a.2.2 right mouse button menu the following will appear on the right mouse menus in code displays, such as program memory and source code files: set/remove breakpoint set or remove a breakpoint at the currently selected line. note: do not step into a sleep instruction. note: you may also right click or double click on a line of code to set a simple breakpoint.
mplab ide reference ? 2008 microchip technology inc. ds51553e-page 73 enable/disable breakpoint enable or disable a breakpoint at the currently selected line. breakpoints remove, enable or disable all breakpoints. run to cursor run the program to the current cursor location. formerly run to here. a.2.3 toolbars when pickit 2 is selected as a debugger, these toolbars are displayed in mplab ide: ? standard debug toolbar (run, halt, animate, step into, step over, step out, reset). ? pickit 2 debug toolbar (program, read, read eedata, connect). a.3 programming functions when you select pickit 2 from the programmer menu, program items will be added to the following mplab ide functions: ? programmer menu ? toolbar a.3.1 programmer menu program program memory areas: program memory, eedata memory, configuration bits and id locations. read read memory areas: program memory, eedata memory, configuration bits and id locations. verify verify programming of memory areas: program memory, eedata memory, configuration bits and id locations. erase erase all data on the device including program memory, eedata memory id and configuration bits. blank check check to see that all device memory is erased/blank. read eedata read eedata memory. connect establish communications between the pickit 2 and the pc. download os download pickit 2 operating system/firmware. release from reset set mclr to v dd .
pickit? 2 user?s guide ds51553e-page 74 ? 2008 microchip technology inc. hold in reset set mclr to ground (zero). settings open the pickit 2 settings dialog (see section a.4 ?settings dialog? .) set up automatic options and enable/disable warnings. a.3.2 toolbar program the target device program memory areas: program memory, eedata memory, configuration bits and id locations. read target device memories read memory areas: program memory, eedata memory, configuration bits and id locations. read the target eedata memory read eedata memory. verify the contents of the target device verify programming of memory areas: program memory, eedata memory, configuration bits and id locations. erase the target device memories erase all data on the device including program memory, eedata memory, id and configuration bits. verify that target memories are erased check to see that all device memory is erased/blank. release from reset set the target mclr pin to v dd . hold in reset set the target mclr pin to v ss . connect establish communications between the pickit 2 and the pc.
mplab ide reference ? 2008 microchip technology inc. ds51553e-page 75 a.4 settings dialog select debugger>settings or programmer>settings to open the settings dialog and set up pickit 2. a.4.1 settings tab this tab of the pickit 2 settings dialog allows you to set automatic options a.4.2 warnings tab this tab of the pickit 2 settings dialog allows you to enable or disable warning messages displayed in the output window. ? to enable/disable specific messages, click the check box next to the message to check/uncheck it. ? to enable/disable all messages, click check all / uncheck all . connect on startup when pickit? 2 is selected as the programmer, immediately attempt to connect. program on successful build when a project builds successfully, immediately attempt to program the device with the updated code. run after successful program when a device program successfully, immediately attempt to run the program. output to debug file output debug information to a file whenever the program is run.
pickit? 2 user?s guide ds51553e-page 76 ? 2008 microchip technology inc. notes:
pickit? 2 user?s guide ? 2008 microchip technology inc. ds51553e-page 77 appendix b. pickit 2 schematics pickit 2 development programmer/debugger schematic diagrams are shown here. demo board schematics are found in their respective user?s guides. figure b-1: pickit? 2 schema tic diagram (page 1 of 2) 5 4 3 2 1 1 2 3 4 5 6 g d s 1 2 3 45 6 7 81 2 3 45 6 7 8 3 1 4 5 2 1 2 3 4 5 6 7 20 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 a0 a2 vss vcc wp scl a1 sda a0 a2 vss vcc wp scl a1 sda - + rb7/kbi3/pgd rb6/kbi2/pgc rb5/kbi1/pgm rb4/an11/kbi0 rb3/an9/ccp2/vpo rb2/an8/int2/vmo rb1/an10/int1/sck/scl rb0/an12/int0/flt0/sdi/sda v ss rc7/rx/dt/sdo rc6/tx/ck rc5/d+/vp rc4/d-/vm mclr/v pp /re3 ra0/an0 ra1/an1 ra2/an2/v ref -/cv ref ra3/an3/v ref + ra4/t0cki/c1out/rcv ra5/an4/ss/hlvdin/c2out v dd v ss osc1/clki osc2/clko/ra6 rc0/t1oso/t13cki rc1/t1osi/ccp2/uoe rc2/ccp1 v usb +5v_usb +5v_usb +5v_usb +5v_usb +5v_usb +5v_usb +5v_usb +v_tgt +5v_usb +5v_usb +5v_usb +5v_usb aux wp mclr_tgt scl sda vdd_tgt_p vdd_tgt_n v dd _tgt_fb v pp _on icspdat icspclk v pp _pump v pp _feedback sda scl wp wp sda scl c1 0.1 f c4 0.1 f c6 0.1 f c7 0.47 f c8 0.1 f c9 0.1 f c10 0.1 f c16 0.1 f c2 22 pf c3 22 pf c5 10 f 16v ds1 ds2 ds3 j2 j1 q1 irlml6402 r1 470 r2 470 r3 470 r8 2.7 k r9 2.7 k r32 10 k r33 33 r34 2.7 k r4 10 k r5 10 k r6 10 k r7 10 k r31 100 sw1 program u3 24lc512 u4 24lc512 u2 mcp6001u u1 pic18f2550/so x1 20 mhz usb power target green yellow icsp nc busy red 2^1 2^0 v dd _tgt_adj nc mini-b note: r32 and c16 not populated tm
pickit? 2 user?s guide ds51553e-page 78 ? 2008 microchip technology inc. figure b-2: pickit? 2 schema tic diagram (page 2 of 2) 6 5 4 3 2 1 1 2 34 5 6 gd s g d s +v_tgt +v_tgt +5v_usb aux mclr_tgt v dd _tgt_p v dd _tgt_n icspdat icspclk v pp _on v pp _pump v pp _feedback c12 0.1 f c13 0.1 f c11 10 f 16v c14 10 f 16v c15 47 f 25v mmbd4148 d1 bat54 d3 zhcs1000 d4 j3 l1 680uh q4 mmbt3904 q7 mmbt3904 q8 mmbt3904 q2 mmbt3906 q3 mmbt3906 q5 mmbt3906 q6 mmbt3906 r12 10 k r16 10 k r17 820 r22 4.7 k r23 100 k r24 2.7 k r25 10 k r26 4.7 k r28 100 r35 4.7 k r36 4.7 k r10 10 r11 33 r13 1k r14 10 r15 33 r19 10 r20 33 r21 1k r27 10 k r29 10 k r30 2.7 k q2(p) q1(n) u5 fdc6420c icsp v pp v dd _tgt low turns on p high turns on n aux icspclk icspdat gnd v dd _tgt v pp v dd _tgt_fb tm
? 2008 microchip technology inc. ds51553e-page 79 pickit? 2 user?s guide index numerics 44-pin demo board ................................................. 31 a animate .................................................................... 71 auto import hex + write device............................... 25 auto-detect .............................................................. 12 b blank check............................................ 11 , 24 , 73 , 74 breakpoints .........................................................72 , 73 c cable length............................................................ 30 calibrate vdd & set unit id .................................... 12 check communication ............................................. 12 code protect .......................................................11 , 23 connect.................................................................... 72 connecting ............................................................... 73 connector, 6-pin ........................................................ 8 current limit ............................................................ 18 customer notification service.................................... 5 customer support ...................................................... 6 d data eeprom memory ........................................... 14 data protect ............................................................. 11 debug express ........................................................ 31 debugging functions ............................................... 71 device selection .................................................12 , 16 documentation conventions........................................................ 3 layout ................................................................. 2 download os ......................................................72 , 73 download pickit 2 programmer operating system. 12 e enable code protect ................................................ 11 enable data protect ................................................. 11 erase....................................................... 11 , 24 , 73 , 74 explorer 16............................................................... 31 export hex ............................................................... 11 f fast programming ................................................... 12 file history ............................................................... 11 firmware .................................................................. 12 firmware, update .................................................... 61 force pickit 2 .......................................................... 12 force target ............................................................ 12 h halt........................................................................... 71 hex file, import........................................................ 19 hold device in reset................................................ 11 hold in reset............................................................ 74 i icsp......................................................................... 27 icspclk/icspdat ................................................. 28 import hex................................................................ 11 import hex file......................................................... 19 install hardware ....................................................... 15 install software......................................................... 16 internet address, microchip ....................................... 5 l leds .......................................................................... 8 low pin count demo board..................................... 31 m mclr ................................................................. 73 , 74 microsoft windows ................................................... 49 mplab ide .............................................................. 71 o operating system .................................................... 12 operating system, update....................................... 61 osccal .................................................................. 12 p pgc/pgd................................................................. 28 program ........................................................72 , 73 , 74 program memory ..................................................... 14 programmer application........................................... 10 programming functions ........................................... 73 push button................................................................ 8 r read........................................................23 , 72 , 73 , 74 read device............................................................. 11 read device + export hex file ................................ 25 read eedata ................................................... 73 , 74 read eedata ........................................................... 72 reading, recommended ........................................... 4 readme...................................................................... 4 reconnect ................................................................ 74 release from reset ................................................. 73 reset hold in............................................................... 74 processor.......................................................... 72 release from..................................................... 73 run........................................................................... 71
pickit? 2 user?s guide ds51553e-page 80 ? 2008 microchip technology inc. s set osccal ............................................................ 12 settings dialog ......................................................... 75 settings tab .............................................................. 75 step .......................................................................... 72 t target power............................................................ 18 target vdd source ................................................... 12 troubleshooting ....................................................... 49 u update firmware...................................................... 61 update operating system ........................................ 61 usb port .................................................................... 8 use vpp first program entry................................... 12 v vdd .................................................... 13 , 18 , 19 , 29 , 49 verify .......................................................11 , 23 , 73 , 74 verify erased............................................................ 74 verify on write.......................................................... 11 vpp ..................................................................... 28 , 49 vss ........................................................................... 30 w warning messages................................................... 75 warnings tab ............................................................ 75 warranty registration................................................. 4 web site, microchip ................................................... 5 write ......................................................................... 20 write device ............................................................. 11 write on pickit button .............................................. 11
index ? 2008 microchip technology inc. ds51553e-page 81 notes:
ds51553e-page 82 ? 2008 microchip technology inc. americas corporate office 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7200 fax: 480-792-7277 technical support: http://support.microchip.com web address: www.microchip.com atlanta duluth, ga tel: 678-957-9614 fax: 678-957-1455 boston westborough, ma tel: 774-760-0087 fax: 774-760-0088 chicago itasca, il tel: 630-285-0071 fax: 630-285-0075 dallas addison, tx tel: 972-818-7423 fax: 972-818-2924 detroit farmington hills, mi tel: 248-538-2250 fax: 248-538-2260 kokomo kokomo, in tel: 765-864-8360 fax: 765-864-8387 los angeles mission viejo, ca tel: 949-462-9523 fax: 949-462-9608 santa clara santa clara, ca tel: 408-961-6444 fax: 408-961-6445 toronto mississauga, ontario, canada tel: 905-673-0699 fax: 905-673-6509 asia/pacific asia pacific office suites 3707-14, 37th floor tower 6, the gateway harbour city, kowloon hong kong tel: 852-2401-1200 fax: 852-2401-3431 australia - sydney tel: 61-2-9868-6733 fax: 61-2-9868-6755 china - beijing tel: 86-10-8528-2100 fax: 86-10-8528-2104 china - chengdu tel: 86-28-8665-5511 fax: 86-28-8665-7889 china - hong kong sar tel: 852-2401-1200 fax: 852-2401-3431 china - nanjing tel: 86-25-8473-2460 fax: 86-25-8473-2470 china - qingdao tel: 86-532-8502-7355 fax: 86-532-8502-7205 china - shanghai tel: 86-21-5407-5533 fax: 86-21-5407-5066 china - shenyang tel: 86-24-2334-2829 fax: 86-24-2334-2393 china - shenzhen tel: 86-755-8203-2660 fax: 86-755-8203-1760 china - wuhan tel: 86-27-5980-5300 fax: 86-27-5980-5118 china - xiamen tel: 86-592-2388138 fax: 86-592-2388130 china - xian tel: 86-29-8833-7252 fax: 86-29-8833-7256 china - zhuhai tel: 86-756-3210040 fax: 86-756-3210049 asia/pacific india - bangalore tel: 91-80-4182-8400 fax: 91-80-4182-8422 india - new delhi tel: 91-11-4160-8631 fax: 91-11-4160-8632 india - pune tel: 91-20-2566-1512 fax: 91-20-2566-1513 japan - yokohama tel: 81-45-471- 6166 fax: 81-45-471-6122 korea - daegu tel: 82-53-744-4301 fax: 82-53-744-4302 korea - seoul tel: 82-2-554-7200 fax: 82-2-558-5932 or 82-2-558-5934 malaysia - kuala lumpur tel: 60-3-6201-9857 fax: 60-3-6201-9859 malaysia - penang tel: 60-4-227-8870 fax: 60-4-227-4068 philippines - manila tel: 63-2-634-9065 fax: 63-2-634-9069 singapore tel: 65-6334-8870 fax: 65-6334-8850 taiwan - hsin chu tel: 886-3-572-9526 fax: 886-3-572-6459 taiwan - kaohsiung tel: 886-7-536-4818 fax: 886-7-536-4803 taiwan - taipei tel: 886-2-2500-6610 fax: 886-2-2508-0102 thailand - bangkok tel: 66-2-694-1351 fax: 66-2-694-1350 europe austria - wels tel: 43-7242-2244-39 fax: 43-7242-2244-393 denmark - copenhagen tel: 45-4450-2828 fax: 45-4485-2829 france - paris tel: 33-1-69-53-63-20 fax: 33-1-69-30-90-79 germany - munich tel: 49-89-627-144-0 fax: 49-89-627-144-44 italy - milan tel: 39-0331-742611 fax: 39-0331-466781 netherlands - drunen tel: 31-416-690399 fax: 31-416-690340 spain - madrid tel: 34-91-708-08-90 fax: 34-91-708-08-91 uk - wokingham tel: 44-118-921-5869 fax: 44-118-921-5820 w orldwide s ales and s ervice 01/02/08


▲Up To Search▲   

 
Price & Availability of PG164120

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X